A slave came and pledged allegiance to the Prophet ﷺ for emigration, and the Prophet ﷺ did not realize 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 anyone's pledge until he had asked whether he was a slave.
حدثنا قتيبة أخبرنا الليث عن أبي الزبير
جاء عبد فبايع النبي ﷺ على الهجرة ولا يشعر النبي ﷺ أنه عبد فجاء سيده يريده فقال النبي ﷺ بعنيه فاشتراه بعبدين أسودين ثم لم يبايع أحدا بعد حتى يسأله أعبد هو
Muslim also narrated it in the Book of Sharecropping, Chapter on the Permissibility of Selling an Animal for an Animal of the Same Kind with an Excess, hadith no. 1602, from Qutayba, with the same chain.On this subject, there is also a narration from Anas [Ibn Majah, no. 2272, and Abu Dawud, no. 2997, and its basis is agreed upon].