The Messenger of Allah ﷺ said, "When a slave under a contract of manumission incurs a legal punishment or inherits an inheritance, he inherits according to the proportion of him that has been freed."
حدثنا موسى بن إسمعيل حدثنا حماد بن سلمة عن أيوب عن عكرمة
أن رسول الله ﷺ قال إذا أصاب المكاتب حدا أو ورث ميراثا يرث على قدر ما عتق منه
Its isnad is sahih. Tirmidhi transmitted it in the Book of Business Transactions, chapter on what has been said about the mukatab when he has enough to pay off, hadith 1259, from the hadith of Hammad bin Salama, with this wording, and he said, hasan. Nasai also narrated it, hadith 4815.