Prohibition on buying something which you have given in charity
This hadeeth was narrated by al-Bukhaari (1490) and Muslim (1620) from Ibn ‘Umar (may Allaah be pleased with him) who said: “I gave a horse to a man to use it in jihad for the sake of Allaah, but the one who was keeping it did not look after it properly. I wanted to buy it back and I thought that he would give it to me for a cheap price. I asked the Prophet (peace and blessings of Allaah be upon him), and he said, ‘Do not buy it, and do not take back what you gave in charity, even if he would give it to you for a dirham, for the one who takes back his charity is like one who takes back his own vomit.’” According to another version, “The one who takes back his charity is like a dog which takes back its own vomit.”
The prohibition on buying back one's charity is because it is given for the sake of Allaah, so one should not have any attachment to it. Buying it back implies that one is still attached to it. This prohibition also exists so that the vendor will not try to do the giver a favour, which would result in him benefitting from his charity.