Save "Maaseh Shabbos 9
"
אמר רב דימי מנהרדעא הלכתא השוחט לחולה בשבת מותר לבריא באומצא מ"ט כיון דאי אפשר לכזית בשר בלא שחיטה כי קא שחיט אדעתא דחולה קא שחיט המבשל לחולה בשבת אסור לבריא גזירה שמא ירבה בשבילו:
Rav Dimi of Neharde’a says that the halakha is: In the case of one who slaughters for an ill person on Shabbat, it is permitted for a healthy person to eat the raw meat [be’umtza]. What is the reason that it is permitted? Since it is impossible for an olive-bulk of meat to be permitted without slaughter of the entire animal, when he slaughters the animal, he slaughters it with the ill person in mind. Since slaughter of the animal was permitted, all its meat is permitted even for a healthy person. In the case of one who cooks for an ill person on Shabbat, it is prohibited for a healthy person to eat the food on Shabbat. What is the reason that it is prohibited? It is due to a rabbinic decree lest he increase the amount of food that he is cooking on behalf of the healthy person.

מיהו כתב בעל הלכות ז"ל דדוקא בכדי שיעשו. וכן דעת רש"י ז"ל וטעמא דמילתא דכיון דאסרינן לה ביומא כדי שלא יהנה ממעשיו הרעים אם אתה מתירה לערב מיד הרי הועילו לו מעשיו. ויש מי שפירש דלמוצאי שבת מותר מיד דלא אמרו בכדי שיעשו אלא בדבר הנעשה ע"י עובד כוכבים כגון שהביא דורון לישראל (ביצה סוף דף כד:) ויש מאותו מין במחובר לקרקע משום דאי שרית ליה לערב מיד אתי למימר ליה בשבת הבא לפי שאמירה לעובד כוכבים קלה היא בעיניו. וכן נמי החמירו בדבר הנעשה על ידי ישראל כשנעשה מאליו וכדתניא בפרק קמא דשבת (דף יח:) לא תמלא אשה קדרה עססיות ותורמוסין ערב שבת עם חשכה ואם עשתה כן למוצאי שבת אסורין בכדי שיעשו לפי שכיון שהדבר נעשה מאליו קל הוא בעיניו ויבא לעשות כן לכתחלה. אבל במבשל ליכא למיגזר דחילול שבת חמיר להו לאינשי ואפילו שרית ליה למוצאי שבת מיד לא אתי למיעבד לכתחלה. וכן כתב הר"ם במז"ל בפרק הנזכר למוצאי שבת יאכל בין הוא בין אחרים מיד. ומ"מ הדבר ברור במבשל לחולה בשבת דמותר לבריא במוצאי שבת מיד דלא בעינן בכדי שיעשו אלא כשנתחלל שבת או בשוגג או במזיד. אבל מבשל ברשות שאינו אסור לבריא אלא משום גזירה שמא ירבה בשבילו לא בעי' בכדי שיעשו:

... either way it is clear that if one cooks for a sick person on Shabbos a healthy person may it the food immediately after Shabbos for there is only a need to wait the amount of time it would take to cook if the cooking was a transgression of Shabbos either by mistake or on purpose, though if one cooks with permission, which is only forbidden to a healthy person on Shabbos to prevent one from cooking for him too, there is no need to wait after Shabbos is over to eat the food.