Sahih al-Bukhari 3003
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
لاَ تَشْتَرِهِ وَإِنْ بِدِرْهَمٍ، فَإِنَّ الْعَائِدَ فِي هِبَتِهِ كَالْكَلْبِ يَعُودُ فِي قَيْئِهِ "
Narrated Aslam:
I heard `Umar bin Al-Khattab saying, "I gave a horse to be ridden in Allah's Cause and the person who got it intended to sell it or neglected it. So, I wanted to buy it as I thought he would sell it cheap. I consulted the Prophet (ﷺ) who said, "Do not buy it even if for one Dirham, because he who takes back his gift is like a dog swallowing its vomit."
Full reference and source
Sahih al-Bukhari 3003 In-book : Book 56, Hadith 212 USC-MSA web (English) : Vol. 4, Book 52, Hadith 247 (deprecated)
View source on Sunnah.com (opens in a new tab)