I borrowed a drug from the communal drug gemach. When I returned the drug that I borrowed, I returned more pills than I received from the gemach because that is what the doctor prescribed and I had no need for the extra pills. Did I violate the prohibition against giving interest because I returned more than the amount that I borrowed?
Before answering your question it is necessary to clarify the nature of the prohibition of ribbis you might have violated. The only ribbis that is forbidden by the Torah is when a lender and a borrower agree at the outset (or when the borrowing period is extended) that the borrower will repay more than he borrowed. However, when ribbis was not stipulated at the time of the original transaction, even if the borrower returns more than the amount that he borrowed, the prohibition is only rabbinic. Since in your case there was no stipulation, if what you did is forbidden the prohibition is rabbinic. One must by no means treat rabbinic prohibitions with any degree of laxity but it is important to note this since some of the rules that govern biblical ribbis do not apply to rabbinic ribbis as we shall see.
There are a number of reasons to rule that what you did is permitted.
One reason to permit is based on the Gemoro (BM 63B) that says that the essence of the prohibition of ribbis is that a borrower is not allowed to pay his lender for using his money. It is permitted to pay rent for using another person’s object. However the Torah forbids paying for using another person’s money. Therefore, one is permitted to pay extra if it is certain that he is not paying extra because he received a loan.
An example is where a talmid chochom borrowed food from another talmid chachom. The Gemoro rules that the borrower may add up to twenty percent when he returns the food. (For example, if he borrowed five eggs he may return six eggs.) The Gemoro says that the reason is because talmidei chachomim are aware that one may not pay interest and we assume that the borrower wanted to give a present to his lender anyway and he just took the opportunity to give a present, but the present was not given for the loan. The reason this law is limited to talmidei chachomim, to food items and up to a fifth, is because only under these conditions did the Rabbonim feel comfortable in assuming that the additional amount was not a result of the loan.
We should note that the Rabbonim did not grant a general permit to one who knows that the reason he gave extra was not because of the loan. It is only if one fulfills the conditions that were set by Chazal to determine that one is certainly not paying extra because of the loan, may the borrower return a larger amount than what he borrowed.
However, if it is obvious to everyone that the borrower is not paying extra because of the loan, the Chelkas Binyomin (YD 160, 68) rules that he may return extra. He proves this from the Gemoro (BB 145B) that rules that in those days, even though presents that close friends (shushbinim) gave each other for their marriages were legally considered a loan, (The friend who receives a present is obligated to give a present when his friend, in turn, gets married.) nevertheless one is allowed to give a larger present to a friend than the present he received from that friend when he got married. Thus even if A gave B a present worth two hundred dollars when B got married, B may give A a present worth three hundred dollars when A weds. The Rishonim explain that the reason is because it is clear that the reason B gives a larger present is because he is so happy and not because he is repaying a debt.
Similarly, the Bris Yehuda (10, footnote 22) rules that a borrower may do a favor for his lender if it is a favor that he does for anyone. For example if A lent B money and B has an apartment that he always allows others to use on Shabbos he may allow A to us it on Shabbos since he permits everyone to use it.
Since everyone knows that people generally give their extra medicine to the medicine gemach because they have no need for the medicine, there is nothing wrong with your having given the entire amount you received from the pharmacy to the gemach.
A second reason many permit you to return extra is because a gemach is an organization to do chessed and as we mentioned at the outset the ribbis you could have violated at worst is only rabbinic. The source for this is the Gemoro that discusses the laws of investments. The Gemoro rules that if A invests money with B, his share in the profits, if any, may not be greater than his share in the loss, if any. Thus if A’s share in case of a loss is fifty percent he may not receive more than fifty percent of the profits because otherwise it is considered ribbis.
However, the Gemoro (BM 70A) rules that when the money which is being invested belongs to orphans, since we want them to prosper, their guardian may invest their money with the provision that they will receive fifty percent of the profits, if any, and yet they will never suffer any loss. Even though this is rabbinic ribbis, the Rabbonim waived their prohibition in order to assist orphans.
The rishonim extend this ruling to money that belongs to any tsedoko organization. Therefore the SA (YD 160, 18) rules that a yeshiva, shul or fund for poor people may invest its money in this manner as well.
Many poskim extend the leniency of the Gemoro to any transaction that constitutes rabbinic ribbis for the same reason: that the rabbonon waived their own prohibition because they were interested in enhancing the assets of orphans and any organization that is dedicated to the fulfillment of mitzvos. Since a gemach to lend medicine to the public falls into this category, according to these poskim since the additional amount that you gave would only be classified as rabbinic ribbis you were permitted to return more medicine than the amount you received.
However, there are poskim who maintain that the rabbonon did not permit every transaction that constitutes rabbinic ribbis. They maintain that only a transaction that, even if it were stipulated would only constitute rabbinic ribbis, is permitted. The reason for this is that the rabbonon only waived their prohibitions in order to invest the funds of orphans. However, a type of ribbis that would constitute a Torah prohibition if stipulated was not waived by the rabbonon because it would not be a suitable investment for the orphans’ money. According to this opinion, this leniency would not apply to your situation since if the gemach would have stipulated at the outset that you must return more than the amount that you borrowed it would be a Torah violation of ribbis. It should be noted that R. Akiva Eiger (res. 53) and the Chavos Da’as (160, chiddushim 19) rule the stringent opinion but many others including the Beis Meir are lenient. The Beis Meir specifically argues with R. Akiva Eiger.
A third reason to be lenient is because of the nature of the ownership of the medicine gemach. The Gemara (BM 57B) rules that the gabbai of hekdesh – the caretaker of the property of the beis hamikdash – was allowed to lend this property even with interest stipulated at the outset. Even though this usually is Torah-forbidden ribbis, since the Torah only forbade ribbis on the possessions of individuals and hekdesh is not owned by any individual, the violation of ribbis does not apply at all. The Rashbo (res 669) maintains that a fund to assist the poor or other needy groups is the same as hekdesh since it is not owned by any individual. The Rashbo however rules that in practice one should not rely on this leniency.
Furthermore many, including the Rosh (res 13, 8), disagree and maintain that even though no particular individual is the owner of the funds nevertheless since the funds must be distributed to poor people the leniency of hekdesh does not apply since the funds are owned by the class of individuals who are poor. Even though we rule that it is not permitted to extend interest-bearing loans with funds that belong to the poor, as we mentioned, hekdesh, meaning funds of the actual Beis Hamikdash, may extend interest-bearing loans.
If the medicine gemach is just a public service and no one owns it then there are poskim (e. g. Tsofnas Pane’ach, Avodo Zoro vol 2 chapter 4, 6) who maintain that it falls into the category of hekdesh and the gabbai may even stipulate at the outset that the borrower must return more than the amount that he borrowed. While it is difficult to rely on this opinion by itself, it would seem that one can rely on the previous leniency and return more if this was not stipulated at the outset. This is so since, according to many, this is always permitted with tsedoko money and even those who are stringent might permit it here since in this case it is only a dispute if there would be a Torah prohibition if ribbis were stipulated at the outset.
In conclusion: There are two reasons you did not violate any prohibition when you returned more medicine to the gemach. One reason is because everyone knows that the reason you gave more was not due to the loan, and second because the gemach is a public tsedoko organization.