It is narrated from Sayyiduna Samurah (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "Whoever comes to own one of his mahram relatives (that is, buys him as a slave), he becomes free (automatically)."
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 6822