Sahih Muslim, Book 10, Number 3901:
There came a slave and pledged allegiance to Allah's Apostle (peace_be_upon_him) on migration; he (the Prophet) did not know that he was a slave. Then there came his master and demanded him back, whereupon Allah's Apostle (peace_be_upon_him) said: Sell him to me. And he bought him for two black slaves, and he did not afterwards take allegiance from anyone until he had asked him whether he was a slave (or a free man).
It is just and commendable that Muhammad does insist on paying the owner, and that he (possibly even) frees this convert (though this is not mentioned), but what about those other two black slaves?
This hadith reports that Muhammad had two black slaves at his disposal to trade in for the other man. And presumably these two were Muhammad's own property. If he had to buy them first before he could exchange them, why would he not just give the owner the value in money or whatever else he would have given the man he got the two from? Also, it seems that the black slaves were worth less than this non-black slave, so that is the reason for the 2:1 rate. We do know this from historical documents (cf. Bernhard Lewis) about slavery in Islamic history that white slaves got a much higher price than black slaves.
Malik's Muwatta, Book 21, Number 21.13.25:
Muhammad got a black slave boy (as a present?) and he starts working for Muhammad. No mention is made that Muhammad freed him.
Sahih Bukhari, Volume 9, Book 91, Number 368:
I came and behold, Allah's Apostle was staying on a Mashroba (attic room) and a black slave of Allah's Apostle was at the top if its stairs. I said to him, "(Tell the Prophet) that here is 'Umar bin Al-Khattab (asking for permission to enter)." Then he admitted me. ... (cf. Bukhari 3.648, 6.435, 7.119)
Note: It does not say "the black slave of Muhammad" it says "a black slave" which is an indication there were more than one.
Sahih Bukhari, Volume 8, Book 73, Number 182:
Allah's Apostle was on a journey and he had a black slave called Anjasha, and he was driving the camels (very fast, and there were women riding on those camels). Allah's Apostle said, "Waihaka (May Allah be merciful to you), O Anjasha! Drive slowly (the camels) with the glass vessels (women)!"
In addition to the above listed hadiths there are a considerable number of other black slaves mentioned which were owned by `Aisha or some of the companions of Muhammad.
Finally, Sahih Bukhari, Volume 2, Book 15, Number 103:
On the days of Mina, (11th, 12th, and 13th of Dhul-Hijjah) Abu Bakr came to her while two young girls were beating the tambourine and the Prophet was lying covered with his clothes. Abu Bakr scolded them and the Prophet uncovered his face and said to Abu Bakr, "Leave them, for these days are the days of 'Id and the days of Mina." 'Aisha further said, "Once the Prophet was screening me and I was watching the display of black slaves in the Mosque and ('Umar) scolded them. The Prophet said, 'Leave them. O Bani Arfida! (carry on), you are safe (protected)'."
The highlighted term in the above hadith may suggest that there was a slave market (display for sale) in the mosque. Obviously, where there are slaves, there must be slave markets, but in this case this is a mistranslation.
It is 'Id time (a festival) and as in many parts of the world at festival times, there are people who entertain others. At the time of Muhammad one of these entertainments is playing with weapons. Like modern days circus dagger thrower or so. The above expression should correctly be rendered "the play of black slaves in the Mosque". [The black slaves actually are called Sudan (sud is black).]
Finally, there are a number of traditions in which Muhammad comments on skin color, see the entry BLACK SKIN.