BENEFIT FROM MELACHAH THAT A NOCHRI DID [Shabbos: Meleches Nochri]
Gemara
(Mishnah): If a Nochri lit a Ner, a Yisrael may use its light;
If he lit it for the Yisrael, it is forbidden.
If a Nochri drew water for his animals, a Yisrael may use it;
If he drew for the Yisrael, it is forbidden.
If a Nochri made a ramp [to descend from a ship], a Yisrael may descend on it;
If he made it for the Yisrael, it is forbidden.
Once, R. Gamliel and Chachamim were on a ship, and a Nochri made a ramp to descend. R. Gamliel and Chachamim descended on it.
Had the Mishnah taught only about a Ner, one might have thought that this is because a Ner for one person helps also for 100, but we forbid water, lest he draw extra for the Yisrael.
(Beraisa): If a Nochri drew water for his animals, a Yisrael may use it. If he drew for the Yisrael, it is forbidden.
This is if he does not know the Yisrael. If he recognizes him, it is forbidden.
Question: The Nochri who made a ramp knew R. Gamliel!
Answer #1 (Abaye): R. Gamliel was not there at the time.
Answer #2 (Rava): Even if R. Gamliel was there at the time, it is permitted. A Ner for one person is good also for 100.
Question (against Abaye and Rava - Beraisa): If a Ner was lit at a party, one may use the light only if the majority are Nochrim.
Answer: It is lit for the majority.
Shmuel visited the house of Avin Torin. A Nochri came and lit a lamp, and Shmuel turned away;
Shmuel saw the Nochri read a document, and realized that he lit it for himself. Shmuel faced the lamp.
Rishonim
Rif and Rosh (46b and 16:12): If he knows him, it is forbidden. This is a decree lest he do extra for him. We are concerned only for matters such as water and grass, but not for matters such as a Ner and a ramp. There is no reason to decree, for a Ner or ramp for one suffices for 100. Even if he knows him, if he did it for himself, it is permitted.
Ran (DH Gemara): The Gemara clearly permits not in front of him. Therefore, we permit when he does not know him even in front of him, and not in front of him even when he knows him. A matter that he would not increase for a Yisrael, such as a Ner and a ramp, is permitted even if he knows him, and even in front of him.
Rambam (Hilchos Shabbos 6:3): If a Nochri lit a Ner, a Yisrael may use its light, unless he lit it for the Yisrael. If a Nochri made a ramp to descend from a ship, a Yisrael may descend on it, unless he made it for the Yisrael. If a Nochri gathered grass, a Yisrael may let his animals eat it afterwards, unless he gathered for the Yisrael. This is only if he does not know the Yisrael, lest he do extra Melachah for a Yisrael. Similarly, regarding anything in which it is possible to do extra for the Yisrael, one may not benefit from it on Shabbos, unless the Nochri does not know him.
Magid Mishneh: Even if he filled for a Yisrael, some Meforshim forbid only for a Yisrael's animal, which could not descend. A Yisrael may drink, for he did not benefit from this. He could have climbed down into the well to drink, and climbed out. Why is grass forbidden? The animal could have eaten it attached! They gave a weak answer, that there was a river in between. Really, even a Yisrael may not drink from the water. The Rambam holds like this.
Magid Mishneh: The Halachah follows Rava. Surely, even if he knows him, if he was not in front of him at the time, we are not concerned lest he do extra for him, like Abaye. Perhaps the Rambam's words include this, and permit whenever there is no concern lest he do for the Yisrael. The Rif omitted Abaye. Perhaps he holds that Rava disagrees, and holds that it depends only on whether he knows him, and whether there is what to do extra. We learn from this that if a Nochri baked bread for himself or another Nochri, it is permitted for a Yisrael, unless he knows the Yisrael and knows that he needs bread. Then there is concern that he made extra for him. The Ramban says so.
Rebuttal (Beis Yosef DH v'Li): If the Rif, Rambam and Rosh held like this, they would have cited Abaye's words. Rather, they hold that Rava disagrees and forbids even not in front of him, since he knows him. It seems that Tosfos (Beitzah 3a) holds like this. R. Yerucham brings this.
Tosfos (Beitzah 3a DH Gezerah): One may not eat salted fish that a Nochri roasted for himself on Shabbos. We forbid what a Nochri filled for himself, lest he fill extra for the Yisrael. Do not say that the fish is different, for the Nochri already roasted it. A Tosefta (Shabbos 14:11) explicitly forbids if he recognizes him, for he accustoms him to come on Shabbos.
Kaf ha'Chayim (325:124) The Yam Shel Shlomo forbids even if he does not know him, lest he be lenient to ask a Nochri to cook.
Poskim
Shulchan Aruch (OC 325:11): If a Nochri gathered grass for his animals, one who does not know him may let his animals eat it afterwards.
Magen Avraham (26): R. Tam permits even if he collected for the Yisrael, unless he is on the other side of the river. The Ba'al ha'Ma'or forbids where there is not much attached grass, for it is not normal to feed it attached grass (one must take it a long way until it eats to satiation - Machatzis ha'Shekel), so the Nochri's act helped.
Mishnah Berurah (64): The primary opinion does not distinguish based on whether or not the Yisrael could have managed without the Melachah. In pressed circumstances, if the Yisrael has no grass, he may rely on the lenient opinion, even if the Nochri gathered for the Yisrael. One may not tell a Nochri to fill from a pit in Reshus ha'Yachid, to Reshus ha'Rabim. If outside the pit is Karmelis, the Chayei Adam (62) permits due to pain to animals. He permits only once a day, but never through a Yisrael.
Kaf ha'Chayim (119): The Rema and Levush limit R. Tam's leniency to needs of man, but not for needs of animals. Most Poskim totally disagree with the leniency.
Kaf ha'Chayim (120): In a city that is mostly Nochrim, one may not take hot water from a Nochri on Shabbos if they make extra for Yisrael, and all the more so if they change for it.
Shulchan Aruch (ibid.): If he knows him, it is forbidden.
Beis Yosef (DH veha'Rif): The Rif, Rambam and Rosh brought only Rava. The Magid Mishneh and Ran hold that Rava agrees with Abaye, and surely permits not in front of him, for there is no concern. Rava comes to permit even in front of him for matters in which there is no concern. The Magid Mishneh permits even in front of him, unless the Nochri knows that the Yisrael needs the matter.
Taz (11): The Beis Yosef forbids even not in front of him. This is only if he knows that the Yisrael will come to feed his animal. Then, we are concerned lest he increase for him.
Magen Avraham (28): Ra'avan says that if the Nochri know that the Yisrael needs, it is forbidden even not in front of him. Also Rashi connotes that the Heter of not in front of him is because he did not know about the Yisrael. If he knew that the Yisrael needed, we say that he did it for him. The same applies if he is in front of him, but the Nochri does not know that the Yisrael needs it. The Mordechai says so. The Beis Yosef and R. Yerucham say that some forbid even if the Nochri already roasted a fish, and there is no concern lest he do extra, like the Tosefta. This is difficult, for R. Yerucham himself and the Tosefta permit not in front of him! Rather, we forbid only salted fish. It is constantly needed. Perhaps he will make more the next Shabbos. If something is not constantly needed, e.g. the Nochri made a linen garment for himself, a Yisrael may wear it. We are not concerned lest he make more for the Yisrael the next Shabbos. The Gemara says so about a ramp, which is not constantly needed. If the Nochri knows him and knows that he needs it, it is forbidden even if he is a professional who makes it to sell (252:4). We say so about turnips of Mechuza (Eruvin 40a). I say that we do not decree about a Ner or ramp for the next Shabbos. We are concerned only lest a Nochri doing for himself add extra for the Yisrael. We are not concerned lest he do Melachah only for the Yisrael. Also Semak says so.
Mishnah Berurah (66): The Mechaber connotes that he forbids even not in front of him, if he knows him. Several Poskim rule like this. The decree applies only if the Nochri knows at the time that the Yisrael needs it. Some are stringent even if he did not know, lest he do extra next Shabbos. When needed, one may be lenient.
Magen Avraham (28): Also, if he knows him, he need not wait after Shabbos the time to do it, since that is only a decree lest he do extra for him. The Beis Yosef said so (Reish 318).
Eshel Avraham: He must wait after Shabbos only if the Melachah was done for him.
Question (R. Akiva Eiger): The Gemara compared this to a bathhouse, and there one must wait the time to do so after Shabbos!
Shulchan Aruch (ibid.): The same applies to anything in which it is possible to do extra for him. In a matter in which there is no concern lest he do extra for him, e.g. he lit a Ner for himself, or made a ramp to descend, for a Ner or ramp for one suffices for everyone, it is permitted even if he knows him.