Umar bin Khattab once gave a horse for the cause of Allah. Later he found it being sold and wanted to buy it back, so he asked the Messenger of Allah ﷺ about it.The Messenger of Allah ﷺ said, "Do not buy it, and do not take back what you have given in charity."
حدثنا عبد الله بن مسلمة عن مالك عن نافع
أن عمر بن الخطاب رضي الله عنه حمل على فرس في سبيل الله فوجده يباع فأراد أن يبتاعه فسأل رسول الله ﷺ عن ذلك فقال لا تبتعه ولا تعد في صدقتك
Muslim, Gifts, chapter "The dislike of a person buying back what he gave in charity from the one he gave it to," hadith 1620, from Abdullah bin Maslama, and Bukhari, Gifts and Their Merit, chapter "If a man lends a horse, it is like a lifetime gift or charity," hadith 2636, from the hadith of Malik through this same chain. It is also found in Muwatta (Yahya) 1/282.