CASES IN WHICH ONE WHO PAID ANOTHER'S LOAN IS COMPENSATED [loan :payment: compensation]
Gemara
(Mishnah): If Reuven is Mudar Hana'ah from Shimon, Shimon may give the (half-)Shekel (that every person must give to Hekdesh each year for Korbanos) on behalf of Reuven, he may pay Reuven's debt...
Kesuvos 108a - Question: Granted, he may give his Shekel, for this is a Mitzvah;
(Mishnah): When they take Shekalim (from the chamber) for Korbanos, they have in mind people whose Shekalim were lost, collected, or will be collected.
But why may Moshe pay Levi's debt? This saves Levi money!
Nedarim 33a - Answer: Paying his debt is considered Mavri'ach Ari (mere prevention of damage).
Question: Which Tana holds like this?
Answer #1 (Rav Hoshaya): It is Chanan (brought below);
Answer #2 (Rava): The Mishnah can even be like Chachamim;
The Mishnah permits paying a debt that was given on condition that the lender may not press the borrower for payment.
(Mishnah - Chanan): If Reuven went overseas and Shimon fed Reuven's wife, Shimon is not reimbursed;
Bnei Kohanim Gedolim say, Shimon swears how much he spent, and he is reimbursed.
Rishonim
Rif (Kesuvos 63b): Our Mishnah is like Chanan, who says that if Moshe fed Levi's wife, Moshe threw away his money. In the Yerushalmi, R. Yosi says that Bnei Kohanim Gedolim say that if Moshe fed Levi's wife, Levi must compensate him, for Levi did not want her to starve. Regarding a debt, he can say 'I would have appeased David (the creditor), and he would have pardoned it.' This is even if David had a security
Rambam (Hilchos Malveh 26:6): If Moshe paid Levi's loan document without Levi's knowledge, even if there was a security, Levi need not pay him. He takes back the security for free. Moshe wasted his money. Perhaps Levi would have appeased the creditor, and he would have pardoned the debt.
Rosh (Kesuvos 13:8): R. Chananel and R. Tam say that the only debt Chanan permits paying is feeding Levi's wife, in which the debt was not clear. Perhaps she would have managed by herself. The Riva proves from the Yerushalmi (cited above in the Rif) that Chanan and Chachamim argue about other debts. We learn from the Heter to give his Shekel, even though this is like a pressuring creditor with a security. R. Tam says that the Yerushalmi surely argues, for it says that Bnei Kohanim Gedolim agree that he may pay his debt, and R. Oshaya said that it is only like Chanan. The Yerushalmi permits giving his Shekel in any case, but the Bavli said that this is only if it was lost. Likewise, the Bavli holds that they argue only about feeding a wife, and the Yerushalmi disagrees.
Ran (Kesuvos DH Yerushalmi): Even though the Bavli is unlike the Yerushalmi, we can learn from the Yerushalmi that Chanan exempts even when there was a pressing creditor with a security, i.e. he did not plan to pardon. We do not find that the Bavli argues about this.
Hagahos Ashri: Some say that likewise, if Levi or his wife was captured and Moshe redeemed him or her, Moshe lost his money. R. Baruch disagrees. Moshe loses only when he fed Levi's wife. Even if he lent to her, Levi must pay. R. Gershom says that if a Nochri stole Levi's house and Moshe bought it from him, Levi cannot take it back without paying Moshe what he benefited him. We say that friends would redeem his land only from a creditor, but not from a robber, who accepts only money, not words.
Mordechai (Bava Kama 59): If one was seized by Nochrim, we redeem him and make him pay back his redemption. We do not exempt him, like one whose loan was paid, which is Mavri'ach Ari. Rashi explains that Mavri'ach Ari applies only when one saves from pain, but not when one saves from a loss. A loan is not called a loss, since it was really owed. Here, the Yisrael was seized for no reason.
Poskim
Shulchan Aruch (CM 128:1): If Moshe paid Levi's loan document without Levi's knowledge, even if there was a security and Moshe took it back, Levi need not pay him. He takes back the security for free. Moshe lost his money. Even if the creditor was pressing Levi to pay, (some texts - perhaps, or we say that) Levi would have appeased him, and he would have pardoned the debt.
SMA (2): It is not known whether or not Levi would have obtained pardon. Moshe cannot make him pay mi'Safek.
Bach (ibid.): R. Chananel holds like R. Tam and the Rosh; all his words are Kabalah. Therefore, if there was a loan document and Moshe seized from Levi, he need not return it, unlike the Shulchan Aruch and Rema.
Shach (3): Not all agree about a pressing creditor. The Rif, Rambam, SMaG, Hagahos Maimoniyos and Ri'az cited the Yerushalmi, but not regarding a pressing creditor. The Yerushalmi learned from the Heter to pay his Shekel, even though Beis Din takes a security for this. The Bavli permits only when Beis Din does not take a security, i.e. Levi gave and the Shekalim were lost! The Yerushalmi itself concludes that if the creditor was pressing, Levi must pay Moshe. If we add (to the above Poskim) R. Chananel, R. Tam, the Rosh, SMA and Bach, who always require paying, the majority require paying when the creditor was pressing. At least it is a Safek, if Moshe seized from Levi, he need not return. Likewise, if Moshe redeemed Levi's security, we do not force him to return it.
Shach (4): Levi cannot say that a pressing creditor would have pardoned the debt. Rather, he can say that he would have found friends to pay it for him (Tosfos Bava Kama 58a DH Iy).
Rema: Some say that this is only if Moshe paid a Yisrael, but if he paid a Nochri, all obligate Levi, all the more so if Moshe redeemed Levi's security. It is proper to rule like this.
Source: Maharil (78), cited in Darchei Moshe (1).
Rashba (4:112 and 5:183, cited in Beis Yosef DH Kosav ha'Rashba): Leaders of the congregation borrowed from a Nochri, and he took animals of Yisraelim for collateral. The owners feared lest the animals die, so they redeemed them. This is not like paying another's debt. Here, the owners were forced to pay. The entire congregation was like partners; all of them needed to pay. This is not Mavri'ach Ari, for the leaders are like overseers or appointees over the congregation.
Rebuttal (of Rema - Shach 6): The Maharil does not say this. Also, it is against the Poskim! The Mordechai (brought above) does not distinguish whether the lender was a Yisrael or Nochri, only whether or not Levi really owed. A Nochri creditor is no worse than a pressing creditor. The Yerushalmi learns from Shekalim, which no one can pardon. Rather, Levi can say that he would have found friends to pay for him (Tosfos). This applies equally when the creditor is a Nochri. People do not pay for theft. Mahariyo (166, brought below) discusses a case in which Leah was guarding Rachel's property and used it to pay what Rachel owed to Nochrim. He exempts Leah because she had Rachel's property, but not because the creditors were Nochrim. The Rashba obligated the congregation because they were like partners, not because the creditor was a Nochri. Above (3) I said that there is a Safek regarding a pressing creditor; the same applies to a Nochri creditor. Perhaps all agree regarding a Nochri creditor that Moshe lost his money.
SMA (4, citing Ir Shushan): Where Nochri merchants grant borrowers (with proper guarantors) much time to pay, Levi can say 'he would have granted me a long time to pay.'
Rema: Some say that this is when Moshe did not have anything of Levi, but if he had Levi's money and paid the debt with it, Levi has no claim against him. Some say that even if Moshe gave his security on behalf of Levi, since he could have given Levi's, Levi must pay him.
Source (Gra 4): We learn from Bava Kama 40b. (Reuven lent Shimon an ox; it was found to be Mu'ad. We do not blame Shimon for letting Beis Din seize the animal after it damaged. Just like Shimon owed (the animal) to Reuven, he owed to the damagee (whom Reuven owed), due to R. Noson's law.)
SMA (5): When Moshe wants to make Levi repay him, Levi can exempt himself by saying 'perhaps he would have pardoned me.' Even if Moshe retrieved a security, Levi is Muchzak. Here, Moshe is Muchzak. He can say 'had I not paid, he would have collected from me due to R. Noson's law.'
Mahariyo (166): Some Poskim exempt Levi from paying Moshe only when Reuven did not have money of Levi. Further, R. Tam and R. Chananel disagree; the Rosh brings their opinion.
Rebuttal (Maharam Lublin 22, cited in Shach 8). Levi is exempt because he could have appeased the creditor. This is even if Moshe had money of Levi!
Defense (Shach 8): Levi is exempt because Moshe was Mavri'ach Ari (Tosfos Bava Kama 58a DH Iy). We assume that he intended for a Mitzvah, but not if he had Levi's money. The correct text of the Mordechai (Kesuvos 311) says that one who fed his married daughter does not lose 'not only if he owed his son-in-law, rather, even if he had a deposit from him.' Actually, the Rema's law is obvious, for R. Noson's law applies even if Moshe has his own money.