Sahih Muslim Book 12, Hadith Number 3954.

Chapter : Disapproval of buying the donated property by the donor himself.

Salim reported from Ibn Umar (Allah be pleased with them) that ‘Umar donated a horse in the path of Allah and then found it being sold, and he decided to buy that. He asked Allah’s Apostle (may peace be upon him) about it, whereupon Allah’s Messenger (may peace be upon him) said: Umar, do not get back what you gave as charity.