Al-Hasan (may Allah have mercy on him) said that the Prophet (peace and blessings be upon him) said: "Whoever buys a goat or a she-camel whose milk has been held back has the choice of one of two things: to return it and give a vessel of grain, or to keep it, that is, the animal."
This mursal version is the preserved (mahfuz) one; Isma'il bin Muslim narrated it from al-Hasan from Anas bin Malik.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب البيوع / 10724