Abu Ayman reported,

I went in to see Ayesha رضي الله عنها and said, "I was a slave belonging to Utbah bin Abu Lahab. When he died, his sons inherited me, and they sold me to Abdullah bin Abu Umar bin Umar bin Abdullah al-Makhzumi. Ibn Abu Umar then freed me, but the sons of Utbah had stipulated that the right of clientage remain with them."Ayesha said, "Barirah came to me when she was a slave under a contract of manumission and said, 'Buy me and set me free.'I said, 'Yes.'She said, 'They will not sell me unless they stipulate that my clientage belongs to them.'I said, 'I have no need of that.'"The Prophet ﷺ heard about this, or word of it reached him, and he mentioned it to Ayesha. Ayesha told him what she had said to Barirah. He said, "Buy her and free her, and let them stipulate whatever they wish."So Ayesha bought her and freed her, and her former owners stipulated the right of clientage. The Prophet ﷺ said, "The right of clientage belongs to the one who frees the slave, even if they stipulate a hundred conditions."

Bukhari 2565

Sahih

حدثنا أبو نعيم حدثنا عبد الواحد بن أيمن قال حدثني

أبي أيمن قال

دخلت على عائشة رضي الله عنها فقلت كنت غلاما لعتبة بن أبي لهب ومات وورثني بنوه وإنهم باعوني من عبد الله بن أبي عمرو بن عمر بن عبد الله المخزومي فأعتقني ابن أبي عمرو واشترط بنو عتبة الولاء فقالت دخلت بريرة وهي مكاتبة فقالت اشتريني وأعتقيني قالت نعم قالت لا يبيعوني حتى يشترطوا ولائي فقالت لا حاجة لي بذلك فسمع بذلك النبي ﷺ أو بلغه فذكر لعائشة فذكرت عائشة ما قالت لها فقال اشتريها وأعتقيها ودعيهم يشترطون ما شاءوا فاشترتها عائشة فأعتقتها واشترط أهلها الولاء فقال النبي ﷺ الولاء لمن أعتق وإن اشترطوا مائة شرط

البخاري 2565صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Mukatab
Chapter
If a mukatab says "Buy me and free me" and he is bought for that purpose
Numbering
Darussalam 2565
Bukhari 2565