Bechorot 56 - Tithes for Animals Bought or Exchanged for Services
If one buys untithed animals or receives them as a gift, he does not have to tithe them. The Torah compared tithes to a firstborn son, and just as children are born into a family and not acquired, so too only animals born in one's herd are tithed. Rabbi Yochanan said: "If one buys ten fetuses in the wombs of their mothers, they will be subject to tithes." Why? Rabbi Elazar said "I saw Rabbi Yochanan in a dream, so my explanation today must be correct." The Torah said, "So shall you do (tithe)" to exclude animals acquired though an additional act of buying.
When is an animal given to a harlot as payment tithed? - When he buys it back. But the sale removes the animal from tithes!? - He gave and re-purchased a fetus. But let the harlot tithe the animal herself!? - She is a Cuthean harlot who, not being Jewish, does not have to tithe. But why not teach us a case of a Jewish harlot? - Only a harlot whom he cannot marry has her payment forbidden, but if marriage could take effect, her payment can be brought as tithe in the Temple.
Art: Jusepe de Ribera - Jacob's Dream