He traced it back to the Prophet ﷺ, who said, "A Muslim does not inherit from a disbeliever, nor does a disbeliever inherit from a Muslim."
حدثنا هشام بن عمار ومحمد بن الصباح قالا حدثنا سفيان بن عيينة عن الزهري عن علي بن الحسين عن عمرو بن عثمان
رفعه إلى النبي ﷺ قال لا يرث المسلم الكافر ولا الكافر المسلم
Bukhari reported it in the chapters on inheritance, in the chapter "A Muslim does not inherit from a disbeliever, nor a disbeliever from a Muslim, and if..." hadith 6764, from the hadith of Zuhri through this route. Muslim also reported it in the chapters on inheritance, in the chapter "A Muslim does not inherit from a disbeliever, nor does a disbeliever inherit from a Muslim," hadith 1614, from the hadith of Sufyan through this route.