RIBIS BEFORE OR AFTER THE LOAN [Ribis: Mukdemes and Me'ucheres]
Gemara
64b (Mishnah): If Reuven lent money to Levi, he may not dwell in Levi's yard for free, or rent from Levi for less than the norm, for this is Ribis.
Version #1 (Rav Yosef bar Minyomi): Even though one who lives in Ploni's yard without Ploni's knowledge need not pay him, if he lent to Ploni money, he must pay him.
Question: Our Mishnah teaches this!
Answer: One might have thought that we forbid only when the yard is normally rented out and Levi normally rents a place to stay. Rav Yosef forbids even a yard not normally rented out, even if Levi does not normally rent a place.
Version #2 (Rav Yosef bar Minyomi): If Reuven lives in Ploni's yard without his knowledge, he need not pay him, but if Ploni told him 'lend to me money and live in my yard', Reuven must pay him.
Version #1 forbids living for free even if Ploni did not suggest the deal, and all the more so, if Ploni suggested it! Version #2 forbids living for free only if Ploni suggested the deal. If Ploni never suggested it, Reuven did not lend in order to live in his yard, so it is permitted.
73b - Question (Ravina): Before the harvest, I give money for wine. I receive an extra measure. Is this permitted?
Answer (Rav Ashi): Yes. Since there was no Tenai, this is just a gift.
75b (Mishnah - R. Gamliel): If Reuven wanted to borrow from Shimon, he may not give to him a gift 'in order that you will lend to me.' This is Ribis Mukdemes (pre-loan Ribis). If he borrowed and returned the money, he may not give to him a gift 'due to your money that was idle with me.' This is Ribis Me'ucheres (post-loan Ribis).
R. Shimon says, there is Ribis of words. The borrower may not inform the lender of Ploni's coming.
(Beraisa - R. Shimon): If Reuven owes Shimon, and he normally did not greet him first with Shalom, he may not do so. "Neshech Kol Davar" forbids even words.
Rishonim
The Rif brings the Mishnah and Beraisa (75b).
Rambam (Hilchos Malveh 5:11): One may not give Ribis before or after. If one wanted to borrow from Ploni, he may not send a gift to him in order that he will lend to him. This is Ribis Mukdemes. If he borrowed from him and returned the money, he may not give to him a gift due to his money that was idle with him.' This is Ribis Me'ucheres. If he transgressed and did so, it is Avak Ribis.
Lechem Mishneh (1): The Rambam connotes that even Stam (without specifying), it is forbidden. Above (4:9) he permits Chachamim to return extra to each other. This implies that others are forbidden. However, the Mishnah connotes that it is forbidden only if he specified. Below (8:9), the Rambam permits returning extra! The Magid Mishneh says that the Rambam forbids when he specifies, and even Stam if it is at the time he pays. The Rambam in Perek 8 connotes that he gives at the time of payment; the Magid Mishneh addresses this. The Tur holds that the Rambam forbids even after payment, and here he forbids even Stam, i.e. but he intends due to the loan. In Perek 8 he permits taking extra, since the giver did not need to do so. We forbid only if it is clearly due to the loan. We permit Chachamim even if they promised from the start to return extra. Other people are forbidden. The Rambam in Perek 4 does not say that that they specified, but the Tur did not want to explain like the Magid Mishnah due to the difficulty in Perek 8.
Rambam (8:9): If one bought wheat, and when he came to collect it the seller gave to him extra, it is permitted, fcor he did so willingly without a Tenai.
Rosh (5:67): Rav Ashi told Ravina that the sellers gave a low price to him. Rashi explains that since he did not stipulate with them, and they did so on their own volition, and did not mention that it was due to his money that was idle with them, it is a mere gift. I am hesitant to permit this. The wording of the Mishnah connotes that Ribis Me'ucheres is forbidden only when he says 'due to your money that was idle with me', i.e. when he sent the gift after the loan was returned. If he gives extra at the time of payment, it looks like Ribis even Stam!
Hagahos Ashri: Why is this different than a lender who lived in the borrower's Chatzer? There, he must pay rental! It seems that there, when he lives there he still owes the money. Here, the gift is after the loan was paid.
Hagahos Ashri (79): Ribis Mukdemes is when he does not specify that it is for the sake of Ribis.
Hagahos Ashri (ibid.): Ribis Devarim is forbidden if he normally did not give Shalom to him first, and now (after he lent to him) he does. Even though the lender benefits and the borrower does not lose, it is forbidden. If he used to do so (before the loan), it is permitted even if the lender benefits and the borrower loses.
Poskim
Shulchan Aruch (CM 160:6): One may not give Ribis before or after. If one wanted to borrow from Ploni, and sent a gift to him (Rema - and specified that it is in order that he will lend to him, or it is a large gift, which is as if he specified) in order that he will lend to him, this is Ribis Mukdemes.
Beis Yosef (DH uvi'Semag): Perhaps if he used to give big gifts, it is permitted even now, for it does not look like Ribis. Or, perhaps it is forbidden because it becomes known. The Tur forbids using his slave or living in his Chatzer, even if he used to do so, for this reason.
Beis Yosef (DH b'Perek): Tosfos (Gitin 20b DH v'Kosev) says that a certain man used to lend to everyone, and they would give or sell fields to him. This is a big gift! It seems that Ribis Mukdemes or Ribis Me'ucheres is only when it is close to the loan; but long before or after, Stam it is permitted.
Taz (3): The Isur is on the borrower, for he knows why he gives. The Rambam forbids Stam when he intends in order that he will lend to him; the Shulchan Aruch permits. When we do not know his intent, Stam we assume that he does not intend for Isur. The Tur explains that the Rambam permits giving extra in a sale.
Shach (10): Stam, a small gift is permitted. The Drishah says in the name of Maharshal that whenever it is known that he intends for the loan, it is forbidden. Perhaps all Poskim agree to this.
R. Akiva Eiger (DH v'Hayah): If he stipulated 'this is a gift on condition that you lend to me. If not, you must return it', this is pardonging a loan on condition that he will lend to him, which is Ribis Ketzuzah.
Beis Yosef (YD 160 DH v'Yesh): Hagahos Ashri connotes that if he specifies, it is Ribis Ketzuzah, for the Rambam says that it is Avak Ribis even without specifying. Or, perhaps Hagahos Ashri holds that without specifying it is a mere Isur, but it is not Avak Ribis.
Shach (8): The Levush says that even if he specifies, it is only Avak Ribis. This is primary.
R. Akiva Eiger (DH v'Chosav): Tosfos forbids Stam. The Beis Yosef was in doubt about Tosfos' opinion when he specifies. The Rema forbids only when he specified. Surely this is only Avak Ribis!
Shulchan Aruch (ibid): If he borrowed from him and returned the money, he may not give to him a gift 'due to your money that was idle with me', this is Ribis Me'ucheres. If he transgressed and did so, it is Avak Ribis.
Beis Yosef (DH v'Lo): If he gives a gift before paying the loan, this is proper Ribis. The Tur says so (166).
Beis Yosef (DH v'Yir'eh): The Mishnah connotes that we forbid only when he specified that the gift is in order that he will lend to him. Also the Rosh says so. The Mordechai (433) learns from the case of living in the borrower's Chatzer. Also Semak says so, and the Magid Mishneh explains Rashi to say so regarding the case with Ravina.
Beis Yosef (DH veha'Rambam): The Tur says that the Rambam forbids even if he did not mention the reason. This is because the Mishnah is in the second person (that you will lend to me... your money was idle with me), and the Rambam wrote in the third person (that he will lend to him... his money that was idle). Sefer ha'Terumos permits if he normally gives gifts to him, as long as he does not intend for Ribis. The Rambam connotes that if ihe normally used to teach the lender, it is permitted even before the money is returned.
R. Akiva Eiger (DH Harei): Normally, one must return Avak Ribis to be Yotzei Yedei Shamayim. Here, he need not (Rema162:2).