Ikrimah bin Khalid narrates that Abdur Rahman bin Umm Hakam, during his illness, intended that his wife should take out a share from his inheritance (for charity, etc.), but the woman refused. So he married three other women and gave each of them a dowry of one thousand dinars. Abdul Malik bin Marwan declared it permissible and made all of them partners in the eighth share. Imam Shafi’i (may Allah have mercy on him) said: “In my opinion, this was the mahr al-mithl (customary dowry), and if it is more than the mahr al-mithl, then the marriage is still valid, but the amount exceeding the mahr al-mithl will be invalid if he dies in that same illness. Because this is in the ruling of a bequest, and a bequest is not permissible for an heir.”
Hadith Referenceمسند الإمام الشافعي / كتاب النكاح / 1121
Hadith Takhrijاسناده ضعيف لعنعة ابن جريج اخرجه البيهقي: 276/6 - وفي المعرفة السنن والآثار له (3927)۔