A slave came and pledged allegiance to the Prophet ﷺ for the Hijrah, and the Prophet ﷺ did not realize that he was a slave. Then his master came seeking him, and the Prophet ﷺ said, "Sell him to me." So he bought him in exchange for two black slaves. After that, he would not accept the pledge of allegiance from anyone without first asking whether he was a slave.
حدثنا محمد بن رمح أنبأنا الليث بن سعد عن أبي الزبير
جاء عبد فبايع النبي ﷺ على الهجرة ولم يشعر النبي ﷺ أنه عبد فجاء سيده يريزه فقال النبي ﷺ بعنيه فاشتراه بعبدين أسودين ثم لم يبايع أحدا بعد ذلك حتى يسأله أعبد هو
Muslim narrated it in the book of transactions, in the chapter on the permissibility of selling an animal for an animal of the same kind with a difference in value, hadith no. 1602, from Ibn Ramh with this chain.