كتاب الهبات
24  
The Book of Gifts
(1)
Chapter: It Is Disliked For A Man To Buy What He Gave In Charity From The One To Whom He Gave It
(1)
باب كَرَاهَةِ شِرَاءِ الإِنْسَانِ مَا تَصَدَّقَ بِهِ مِمَّنْ تَصَدَّقَ عَلَيْهِ ‏‏
Sahih Muslim 1621 a

Ibn 'Umar reported that 'Umar b. al-Khattib (Allah be pleased with him) donated a horse in the path of Allah and (later on) he found it being sold, and he decided to buy that. He asked the Messenger of Allah (ﷺ) about it. whereupon he (the Holy prophet) said:

Don't buy that and do not get back what you gave in charity.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، أَنَّ عُمَرَ، بْنَ الْخَطَّابِ حَمَلَ عَلَى فَرَسٍ فِي سَبِيلِ اللَّهِ فَوَجَدَهُ يُبَاعُ فَأَرَادَ أَنْ يَبْتَاعَهُ فَسَأَلَ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنْ ذَلِكَ فَقَالَ ‏ "‏ لاَ تَبْتَعْهُ وَلاَ تَعُدْ فِي صَدَقَتِكَ ‏"‏ ‏.‏
Reference : Sahih Muslim 1621a
In-book reference : Book 24, Hadith 5
USC-MSA web (English) reference : Book 12, Hadith 3952
  (deprecated numbering scheme)