Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) said that Aishah (may Allah be pleased with her), the wife of the Prophet (peace and blessings be upon him), intended to buy a slave girl and set her free, but her owners said: We will sell her, but the wala' will be ours. Aishah (may Allah be pleased with her) mentioned this to the Prophet (peace and blessings be upon him). He (peace and blessings be upon him) said: "Let nothing stop you; the wala' belongs to the one who frees."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الولاء / 21466
Al-Hasan (may Allah have mercy on him) said: The inheritance of an abandoned child (foundling) goes to the Muslims, and the liability for his offences is also placed on them; the one who raises him receives only the reward.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الولاء / 21467