The gemara (Kesubos 34b) links two halachos as being dependent on the same underlying presumption:
1) Rav Papa holds if someone slaughters a borrowed cow on Shabbos, he is exempt from paying for the cow since he receives the death penalty for violating Shabbos – one cannot receive two punishments for the same crime (kam leih b’derabba minei). The gemara elaborates on what the chiddush of this case is. Double-jeopardy, kam leih b’derabba minei, exempts only payments of restitution, not fines (knas). One might have thought that the obligation of restitution takes effect when the cow is borrowed, which has nothing to do with the Shabbos violation; slaughtering only adds the additional obligation of paying a fine for tevicha, which the death-penalty does not exempt, leaving the borrower obligated on all counts. Rav Papa rejects this argument and holds that the obligation of restitution does coincide with the slaughter of the cow on Shabbos, not earlier. Since we cannot penalize a person to pay and receive death, the obligation to pay restitution is cancelled, and since a fine cannot be imposed unless a base obligation exists, the fine is also removed.
2) If someone borrowed a cow and died, and his heirs unwittingly killed the borrowed cow, the gemara assumes that whether the heirs must repay the lender from their father’s estate depends on the same question raised by Rav Papa’s previous case. If the obligation to make restitution for a borrowed animal (or return it) is incurred at the moment the animal is borrowed, a lien exists against the father’s estate from before his death; however, if Rav Papa is right, then the obligation to make restitution does not begin until the time the cow is slaughtered, at which point the father is dead and no lien is in place.
The Rambam breaks the link between these two laws and paskens (Gneiva 3:4) like Rav Papa that a borrower who kills a cow on Shabbos is exempt from payment, but against Rav Papa (Sh’eila 1:10) that heirs who slaughter a cow which their father borrowed must make restitution from their father’s estate. Leaving aside how the Rambam reads the gemara (the meforshim suggest a different girsa), how can the Rambam be explained as internally consistent? Stay tuned...