Sunan Abi Dawud, Hadith 2909

Narrated Ibn 'Umar: 'Aishah, mother of believers (ra), intended to buy a slave-girl to set her free. Her people said: We shall sell her to you on one condition that we shall inherit from her. 'Aishah mentioned it to the Messenger of Allah. He said: That should not prevent you, for the right of inheritance belongs to the one who has set a person free.

حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، قَالَ قُرِئَ عَلَى مَالِكٍ وَأَنَا حَاضِرٌ، قَالَ مَالِكٌ عَرَضَ عَلَىَّ نَافِعٌ عَنِ ابْنِ عُمَرَ، أَنَّ عَائِشَةَ، رضى الله عنها أُمَّ الْمُؤْمِنِينَ أَرَادَتْ أَنْ تَشْتَرِيَ جَارِيَةً تَعْتِقُهَا فَقَالَ أَهْلُهَا نَبِيعُكِهَا عَلَى أَنَّ وَلاَءَهَا لَنَا ‏.‏ فَذَكَرَتْ عَائِشَةُ ذَاكَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏ "‏ لاَ يَمْنَعُكِ ذَلِكَ فَإِنَّ الْوَلاَءَ لِمَنْ أَعْتَقَ ‏" ‏ ‏.‏

sunnah.com

also referenced under: Hadith 2915 (DarusSalam)