WHEN AND TO WHOM IS MELECHES SHABBOS PERMITTED? [Shabbos:Chilul:benefit]
Gemara
(Beraisa - R. Meir): If one cooked on Shabbos b'Shogeg, he may eat it. If he was Mezid, he may not eat it;
R. Yehudah says, if he was Shogeg, he may eat it after Shabbos. If he was Mezid, he may never eat it;
R. Yochanan ha'Sandlar says, if he was Shogeg, after Shabbos others may eat it but not him. If he was Mezid, even others may never eat it.
R. Yochanan ha'Sandlar expounds like R. Chiya. "Shabbos... is Kodesh to you" - just like one may not eat Kodesh, one may not eat Ma'ase (something made on) Shabbos. "To you" teaches that one may benefit from it.
Chulin 15a (Rav Chanan bar Ami): Rav would rule to his Talmidim like R. Meir. In public he ruled like R. Yehudah, due to ignoramuses.
The Mishnah forbids eating meat slaughtered on Shabbos. Rav established it to be like R. Yehudah. This implies that R. Meir would permit it! R. Meir permits only when a person (in the household) was (dangerously) sick when Shabbos began (they planned to slaughter for him if necessary, so the animal was not Muktzeh).
Beitzah 24b (Rav Papa): The Halachah is, if a Nochri brought a gift for a Yisrael on Yom Tov, if some of the species are attached (to the ground), they are forbidden until bi'Chdei she'Ya'asu (the time needed to do the Melachah, in this case to pick them) after Yom Tov. If none of the species are attached, they are permitted only if they were brought from inside the Techum. If they were brought for one Yisrael, they are permitted to other Yisraelim.
Rishonim
Rif (Shabbos 17a, also brought in Rosh Chulin 1:18): The Halachah follows R. Yehudah, who says that if one cooked b'Shogeg, he or others may eat it after Shabbos. If he was Mezid, others may eat it after Shabbos, but he may not.
Rosh (ibid.): The Ri says that the Halachah follows R. Meir. The Ge'onim say that nowadays we expound in public to ignorant people, so we rule like R. Yehudah.
Rashi (Chulin 15a): No one may benefit from Meleches Shabbos, i.e. what was done b'Mezid. Therefore, all agree that no one may benefit until bi'Chdei she'Ya'asu (the time needed to do the Melachah after Shabbos).
Rambam (Hilchos Shabbos 6:23): If a Yisrael did Melachah on Shabbos b'Mezid, he may never benefit from it. Other Yisraelim may benefit from it on Motza'ei Shabbos immediately. If a Yisrael cooked on Shabbos b'Mezid, others may eat it after Shabbos, but he may never eat it. If he was Shogeg, he or others may eat it immediately after Shabbos. The same applies to everything similar.
Magid Mishneh: The Ramban forbids to everyone bi'Chdei she'Ya'asu, even if the Melachah was b'Shogeg, lest they benefit from Ma'aseh Shabbos.
Question: If a Nochri prepared needs of burial on Shabbos, the Ramban (cited in Magid Mishneh 6:5) says that no one may use them bi'Chdei she'Ya'asu because we make a uniform decree! Why don't we forbid here to everyone permanently (like to the Mevashel) for the sake of a uniform decree?
Answer (Lechem Mishneh): A Nochri is not commanded about Shabbos, so there is no reason not to benefit from what he did on Shabbos. It is reasonable to say that we do not distinguish, and forbid bi'Chdei she'Ya'asu to everyone. It is unreasonable to be so stringent and forbid it permanently to everyone just for a uniform decree.
Question: Why doesn't the Rambam forbid here to everyone bi'Chdei she'Ya'asu?
Answer (Lechem Mishneh): In any case the decree will not be uniform, since we will not forbid them permanently like the Mevashel, therefore we are not stringent about others at all.
Rosh (19): We are stringent to require waiting bi'Chdei she'Ya'asu when a Nochri did Melachah for a Yisrael, or if a Yisrael caused Melachah to be done on Shabbos in a forbidden way, e.g. he left a pot of raw food on the fire just before Shabbos. This stringency does not apply when a Yisrael did Melachah on Shabbos. This is uncommon, so we do not decree.
Hagahos Ashri: If there are attached fruits of a species, we forbid fruits detached on Shabbos, lest a Yisrael detach them or tell a Nochri to do so. It is an exertion to dig up turnips or trap fish, so we do not decree about them. However, they are Muktzeh unless he expected a Nochri to pick them. Similarly, juice that exuded from fruits is forbidden lest one squeeze, even if the fruits were intended to be eaten.
Poskim
Shulchan Aruch (OC 318:1): If one cooked on Shabbos (Rema - or did any other Melachah) b'Mezid, he may never eat it. Others may eat it immediately after Shabbos.
Bach (DH u'Mah she'Chosav): The Poskim require bi'Chdei she'Ya'asu only when a Nochri did the Melachah, lest Yisraelim come to ask Nochrim to do Melachah. Rashi says that it is to avoid benefit from Meleches Shabbos; this applies even when a Yisrael transgressed.
Rebuttal (Magen Avraham 2): Rashi would say that we did not decree about this, for it is uncommon (see the end of the Rosh above).
Magen Avraham (2): It seems that the one for whom it was cooked may never eat it, just like the Mevashel. The Shulchan Aruch (YD 99:5) forbids one for whom someone was Mevatel an Isur. However, the Beis Yosef there connotes that this is only there, for we are concerned lest the Yisrael ask a Yisrael or Nochri to do so.
Kaf ha'Chayim (12): Some say that the one for whom it was cooked should be stringent. Surely if an innkeeper regularly cooks on Shabbos, one may not benefit from it due to Lifnei Iver and helping transgressors.
Mishnah Berurah (3): The Rashba (Teshuvah 1:175) forbids also the pot because it absorbed Isur. If he cooked for a Choleh, it is permitted.
Kaf ha'Chayim (9): Some permit the pot. In any case one may Kasher it using boiling water three times, even if it is earthenware.
Kaf ha'Chayim (10): If he was Mezid it is forbidden to his household forever.
Shulchan Aruch (ibid.): If he was Shogeg, it is forbidden on Shabbos also to others. After Shabbos it is permitted also to him immediately.
Beis Yosef (DH v'Chosav): The Rashba, Ran and Magid Mishneh say that if someone cooked or uprooted food for a Choleh, all permit it immediately on Motza'ei Shabbos. Bi'Chdei she'Ya'asu is needed only when there was Chilul Shabbos b'Shogeg or b'Mezid. Here, the Melachah was permitted. It is forbidden to a healthy person only due to Muktzeh, or due to a decree lest one do extra for a healthy person, so we do not require bi'Chdei she'Ya'asu.
Tur: It would seem that according to the Ri, who rules like R. Meir, all Melachos are like cooking, and if it was Shogeg he himself may use the result on Shabbos. However, Sefer ha'Terumos says that this is only regarding cooking, for the food could have been eaten raw. Regarding slaughter or other Melachos, even b'Shogeg it is forbidden to him.
Beis Yosef (DH v'Davka): The Tur should say 'regarding slaughter or other Melachos (b'Shogeg), it is forbidden to everyone on Shabbos, due to Muktzeh. Sefer ha'Terumos explicitly says so.
Kaf ha'Chayim (14): If Motza'ei Shabbos was Yom Tov, many say that the food is forbidden on Yom Tov, because Shabbos cannot be Mechin (prepare) for Yom Tov. Some say that Hachanah does not apply here. One should be stringent, unless it is something that can be eaten raw.
Rema (YD 102:4): Davar she'Yesh Lo Matirim is only if the food will be permitted to the one to whom it is forbidden. If Ploni cooked b'Mezid on Shabbos, even though it is permitted to others (after Shabbos), since it is always forbidden to Ploni, it is Ein Lo Matirim.
Question (Magen Avraham 318:2): Terumah is Ein Lo Matirim regarding Kohanim (it is always permitted to them) and Yisraelim (it is always forbidden to them). Here, the food is Yesh Lo Matirim regarding everyone else, so it is not Batel even for Ploni! This is like Bikurim, which is not Batel even for Yisraelim because it has a Heter for Kohanim in Yerushalayim! Even though R. Shimshon says that it is Batel for Yisraelim, the Rambam and Bartenura say that it is not. One should be stringent. Perhaps the Shulchan Aruch refers to when it became mixed after Shabbos. Then it is truly like Terumah (it is totally permitted to others, and totally forbidden to the Ploni).
Mishnah Berurah (318:5): The Chavas Da'as holds that it is Ein Lo Matirim for the Mevashel. All agree that for others it is Yesh Lo Matirim.
Kaf ha'Chayim (15): Some are stringent and forbid the mixture to the Mevashel forever. We may rely on the lenient opinions to permit it after Shabbos. R. Akiva Eiger concurs.