Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "A child cannot repay his father, except in one case: that he finds the father a slave, buys him and frees him."
His words "buys him and frees him" possibly mean that he frees him by the purchase itself; and Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21414