(3) باب إِنَّمَا الْوَلاَءُ لِمَنْ أَعْتَقَ
Ibn Umar reported that 'A'isha decided to buy a slave-girl and then set her free, but her masters said:
We are prepared to sell her to you on the condition that her right of inheritance would vest with you. She (Hadrat A'isha) made a mention of that to Allah's Messenger (ﷺ) whereupon he said: This should not stand in your way. The right of inheritance vests in one who emancipates.
Reference: Sahih Muslim 1504 a
In-book reference: Book 20, Hadith 7
USC-MSA web (English) reference(deprecated numbering scheme): Book 9, Hadith 3584