Narrated ‘Abdullah bin ‘Umar (radiallaahu `anhu):
Umar bin Al-Khattab (radiallaahu `anhu) gave a horse in charity in Allah’s Cause and later he saw it being sold in the market and intended to purchase it. Then he went to the Prophet (sallallaahu `alayhi wasallam) and asked his permission. The Prophet (sallallaahu `alayhi wasallam) said, “Do not take back what you have given in charity.” For this reason, Ibn ‘Umar (radiallaahu `anhu) never purchased the things which he had given in charity, and in case he had purchased something (unknowingly) he would give it in charity again.
Narrated ‘Umar (radiallaahu `anhu):
Once I gave a horse in Allah’s Cause (in charity) but that person did not take care of it. I intended to buy it, as I thought he would sell it at a low price. So, I asked the Prophet (sallallaahu `alayhi wasallam) about it. He said, “Neither buy, nor take back your alms which you have given, even if the seller were willing to sell it for one Dirham, for he who takes back his alms is like the one who swallows his 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 favor which would result in him benefiting from his charity.
Can we take back charity before the recipient takes possession of it? Answer here.