Ketubot 91 - Two groups of children from two wives want the inheritance
When people were allowed to have more than one wife, fathers were reluctant to give large dowries to their daughters. They were apprehensive that when their daughter and her husband eventually die, the inheritance will go to the children of the other wife. Therefore, the Sages established a rule that when the children come to claim the inheritance, they can ask for their late mother’s Ketubah first. Then they would divide the remaining estate equally with the children of the other wives. This is called "Ketubah of the (male) children."
Now imagine that it did happen: someone was married to two wives, they both died, then he died, and now the children all want the inheritance. This is where the above rule would kick in.
However, if there is not enough money to pay both the Ketubah of the first and the second wife, then there will be no leftover inheritance to divide: everything will be paid out as a Ketubah payment. Then the law of the inheritance from the Torah will be abrogated completely! - at least in this case. That the Sages did not want, so they limited their rule to only cases where there is enough money to pay both Ketubahs, and then some. If there is not enough, then the rule above is not used, but instead everyone divides equally, which is the Torah law. Even if one group of the children wants to add money to the inheritance, so that there is enough for the Ketubah, and then gain by getting the larger Ketubah of their mother, they are not listened to.
Art: The Three Fishers Wives by Mrs Henry Harewood Robinson