(17) باب الْمُكَاتَبِ وَمَا لاَ يَحِلُّ مِنَ الشُّرُوطِ الَّتِي تُخَالِفُ كِتَابَ اللَّهِ
Narrated `Amra:
Aisha said that Buraira came to seek her help in the writing of her emancipation. `Aisha said to her, "If you wish, I will pay your masters (your price) and the wala' will be for me." When Allah's Messenger (ﷺ) came, she told him about it. The Prophet (ﷺ) said to her, "Buy her (i.e. Buraira) and manumit her, for the Wala is for the one who manumits." Then Allah's Messenger (ﷺ) ascended the pulpit and said, "What about those people who stipulate conditions which are not in Allah's Laws? Whoever stipulates such conditions as are not in Allah's Laws, then those conditions are invalid even if he stipulated a hundred such conditions."
Reference: Sahih al-Bukhari 2735
In-book reference: Book 54, Hadith 22
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 3, Book 50, Hadith 893