Umar bin Khattab once gave a horse as a contribution in the cause of Allah. Later he found it being offered for sale and wanted to buy it back. He asked the Messenger of Allah ﷺ about it, and the Prophet said, "Do not buy it, and do not take back what you have given in charity."
حدثنا إسماعيل قال حدثني مالك عن نافع
أن عمر بن الخطاب حمل على فرس في سبيل الله فوجده يباع فأراد أن يبتاعه فسأل رسول الله ﷺ فقال لا تبتعه ولا تعد في صدقتك