Sunan an-Nasa'i, Volume 5, Book 44, Hadith 4647 (DarusSalam)

It was narrated from Aishah that: she wanted to buy Barirah to set her free, but they stipulated that her loyalty (should be to them. She mentioned that to the Messenger of Allah and the Messenger of Allah said: "Buy her, and wet her free and loyalty (Wala) belongs to the one who sets the slave free." Some meat was brought to the Messenger of and it was said that this had been given in charity to Bariirah. He said: "It is charity for her, and a gift for us." And she was given the choice

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

sunnah.com