Bechoros, Chapter 8, Mishnah 3. From here onward, the Mishnah begins a series of cases dealing with uncertainties: we have no way of knowing clearly who the firstborn was, and the question is what the halachah is.
The first case:
"Mi shelo bichrah ishto veyaldah shnei zecharim" - a woman who had never given birth before, and gave birth to two sons who became mixed up at the time of their birth (for example, if she gave birth in a dark cave, and the next day they do not know which of them was born first). It is therefore clear that the father has a firstborn son from this mother, but it is unknown which of the two sons it is.
"Nosen chamesh sela'im lakohen" - the father is obligated in the redemption of his firstborn son, and even though he does not know who it is, he must give the five selas for him, because whichever one it may be - the obligation exists.
"Mes echad meihen besoch shloshim yom" - the verse says: "And those that are to be redeemed, from a month old you shall redeem." The obligation of redemption takes effect from the age of one month and onward, and beforehand there is no obligation at all. Therefore, if the son who died was the one who was the firstborn, the obligation of redemption never took effect upon him, and once again there is no certainty that an obligation exists.
And this is the rule that accompanies all these Mishnayos: the burden of proof rests upon the kohen, as "one who extracts from his fellow bears the burden of proof." If the kohen wishes to obligate the father in the five selas, he must prove that they belong to him, and here again he has no proof. Therefore we learned that the father is exempt.
"Mes ha'av vehabanim kayamin":
Here both sons passed the age of thirty days while the father was still alive, so that the obligation of redemption already took effect, while the father died before giving the five selas. Each son in and of himself does not know that he is the firstborn, and is therefore personally exempt: to any kohen who comes to claim from him he can say "one who extracts from his fellow bears the burden of proof," and there is no obligation on the son to redeem himself.
However, since the obligation took effect upon the father during his lifetime, the debt rests upon his property as a monetary debt to the kohen, and the kohen has a claim against the estate. The question is what the halachah is when the sons divided the property before the kohen collected what was due to him, and regarding this Rabbi Meir and Rabbi Yehudah disagree.
The root of the dispute lies in the concept of "bereirah" (retroactive designation), and delving into it is complex and beyond the scope of explaining the Mishnah. We will therefore focus on the bottom line of the two opinions.
The opinion of Rabbi Meir:
The status of the two brothers after they divided the inheritance between themselves - so according to the Bartenura, whereas in the Gemara the matter is in doubt - is the status of "purchasers": it is as if each of them traded and bought his portion in exchange for his share in the other half.
For a purchaser, the law is that the property he bought is not subject to a lien for prior debts, unless they were recorded in a document. A loan made only verbally (a 'milveh al peh') does not create a lien on the property. In contrast, if someone buys property and the seller's wife comes and claims her unpaid kesubah, she can collect from the purchased property. This is because a kesubah is a documented debt (a 'milveh bishtar'), a debt recorded in a document which thereby imposes a lien on the property.
The obligation of the five selaim left by the father does indeed exist upon the estate, but it has no physical record: there is no promissory note and no contract. Therefore, each of the brothers can say to the kohen: You do not have a document, and I am not obligated to pay you from the half that I purchased; it was never proven that I am the firstborn, and although the estate was indeed obligated to you, I am taking it as a purchaser, and I have no obligation toward you.
Therefore, we learned: "Im nasnu ad shelo chalku - nasnu" - if the five selaim were given to the kohen prior to the division of the estate, what was given is given, because at that time the obligation still rested upon the estate and the kohen collected rightfully. "Ve'im lav - peturin" - if the kohen did not receive his payment before the brothers divided the estate, each of them is exempt, since his legal status is that of a purchaser.
The View of Rabbi Yehudah:
Rabbi Yehudah disagrees and holds that the status of the two sons is that of heirs (this too is based on the assumption regarding 'bereirah', retroactive clarification), meaning that each of them inherited encumbered property, and they do not have the status of a purchaser which would exempt them from payment. Therefore, when the kohen comes and claims the five selaim from them, they are obligated to pay and to divide the expense equally, because the claim remains in force upon the property.
Some of the commentators explain the words of Rabbi Yehudah in an alternative and interesting way: Even Rabbi Yehudah concedes that their status is that of purchasers, but he says to them - it is true that a purchaser is not obligated to pay for a debt that was not recorded in a document but was only made through a verbal agreement; however, since the Torah itself wrote that the father is obligated in these five selaim, the obligation of redeeming the firstborn (pidyon haben) is considered a documented debt, as if it were written in a contract - the Torah wrote it in black and white, so to speak. According to this approach as well, Rabbi Yehudah's conclusion is that they must pay the kohen.
And the halachah in any case follows Rabbi Yehudah: The estate is obligated, and therefore the heirs pay - the kohen collects the five selaim from the two brothers, and they divide the payment equally.