It is narrated from Ibn Umar (may Allah be pleased with them) that the Messenger of Allah (peace be upon him) said: "Whoever sells a slave who possesses wealth, then his wealth belongs to the seller, unless the buyer stipulates a condition, then it belongs to him."
Hadith Referenceمسند الإمام الشافعي / كتاب البيوع / 1369