Pesachim 46b: Rabbah said that one who cooks on Yom Tov for the next day does not violate a Torah prohibition because theoretically, guests may come today and eat the food. Although Rabbinically it is prohibited, Chazal made an exception when Yom Tov falls on Friday and one makes an eiruv tavshilin.
Rema 527:20: One who is fasting on Yom Tov is forbidden to cook for others. R’ Akiva Eiger: This is only when one is abstaining from all food, but if one abstains from a particular food because of a chumra (e.g. kitnios), he is allowed to cook it for others, or even for himself to eat on the following day, since others could eat it today. Maharsham and Chazon Ish disagree with this in the case of kitnios but agree in the case of gebrokts.
פסחים מו ע”ב איתמר, האופה מיום טוב לחול, רב חסדא אמר: לוקה, רבה אמר: אינו לוקה. רב חסדא אמר: לוקה, לא אמרינן הואיל ומיקלעי ליה אורחים חזי ליה. רבה אמר: אינו לוקה, אמרינן הואיל. אמר ליה רבה לרב חסדא: לדידך, דאמרת לא אמרינן הואיל ־ היאך אופין מיום טוב לשבת? אמר ליה: משום עירובי תבשילין. ־ ומשום עירובי תבשילין שרינן איסורא דאורייתא? ־ אמר ליה: מדאורייתא צורכי שבת נעשין ביום טוב, ורבנן הוא דגזרו ביה, גזירה שמא יאמרו אופין מיום טוב אף לחול. וכיון דאצרכוה רבנן עירובי תבשילין ־ אית ליה היכירא.
שו”ע או”ח תקכ”ז ס”כ ברמ”א: ומי שמתענה ביום טוב אסור לבשל לאחרים אפילו לצורך בו ביום דהוי כמי שלא הניח עירוב שאינו מבשל לאחרים (מהרי״ו).
וכתב המ”ב דהאחרונים חולקים על הרמ”א, וכתב ר’ עקיבא איגר (שו”ת א,ה) דאפילו להרמ”א היינו דוקא במי שמתענה אבל מי שנוהג איסור בדבר מסוים מותר לבשל לאחרים האוכלים אותו, או לעצמו על שבת אם אוכל אותו בשבת (כגון אשכנזי בן א”י המבשל קטניות לאחרון של פסח, הואיל וחולים או ספרדים יכולים לאכלו בו ביום(. והמהרש”ם בדעת תורה (תקכז,א) אסר דלא אמרינן הואיל ואי מיקלעי ליה אורחים כיון שמחזיק אותו כאיסור, וגם החזון איש (מט,טז) אסר מטעם אחר משום מוקצה, אבל שניהם כתבו דמותר לבשל מצה שרויה לאחרון של פסח, דאף המחמירים סוברים דמעיקר הדין מותר שהרי באחרון של פסח אוכלים, ולכך מותר לבשל ביו”ט הואיל ואם בא אורח הנוהג היתר היה יכול לאכלו בו ביום.
R’ Yaakov Kamenetsky told the following story about his great-great-great uncle, R’ Eliyahu Schick.
(R’ Eliyahu Schick’s sister was the grandmother of Chaya Shereshevsky, who married R’ Shmuel Hirsch Kamenetsky, R’ Yaakov’s grandfather.)
Once, while R’ Eliyahu was the rav of Derechin, there was a devasting fire, and he went to collect donations to help families rebuild. He came to the town of Smargon, where his cousin by marriage, R’ Leibele Shapiro (also known as R’ Leibele Kovner), who was the rav of the town, accompanied him. When they came before the home of a wealthy Chabad chassid, R’ Leibele told him there was no use going into that house because the owner would not contribute to anything in Derechin, a shtetl known to be a center of misnagdim. R’ Eliyahu himself was also personally considered to be a fervent misnaged, to the extent that Chassidim accused him of deliberately giving a psak to cause them suffering. In the year 1873, when Pesach fell on Shabbos, R’ Eliyahu prohibited the preparation of knaidlach on Friday for the last day of Pesach because he held that one may cook on Yom Tov for use on Shabbos only such food as one may eat on Yom Tov itself. When R’ Eliyahu passed away a year and a half later, the Chassidim contended that he was punished from Heaven because his ruling had prevented them from enjoying knaidlach on the single day out of Pesach when they were allowed to eat them.
R’ Eliyahu said, “I will bet you a ruble for the Volozhin Yeshiva that I can get a donation from him.” He went in and came out with three rubles. “How did you do it?” asked R’ Leibele. “I told him a story about the Alter Rebbe,” said R’ Eliyahu.
R’ Leibele then said, “You gained three rubles, and here is my ruble for Volozhin, but I cannot accompany you any longer because the Torah commands מדבר שקר תרחק.”
R’ Leibele was a talmid of R’ Chaim Volozhiner, and his son, R’ Refoel Shapiro, was the Netziv’s son-in-law and successor as rosh yeshiva of Volozhin when it reopened in 1899. R’ Refoel’s son-in-law was R’ Chaim Brisker.
When R’ Leibele was on his deathbed, R’ Yisroel Salanter wanted to visit him, but R’ Leibel refused because he was opposed to the Mussar movement. People said to him, “Is this the time for machlokes?” R’ Leibele replied, “If not now, when? Will I not be going off in a short time to the World of Truth?”
R’ Yisroel Salanter said in his hesped on him, “The posuk in Daniel (8:12) says, ‘Truth will be cast down to the ground.’ What we are doing now is burying truth underground.” The ability to perceive one’s adversary as being truthful – while wrong – because he is consistent in his outlook indicates that R’ Yisroel himself was so unequivocally committed to truth that he had greater esteem for one who was truthful than for one who was in agreement with his Mussar approach.
[R’ Eliyahu evidently held that those who don’t eat gebrokts consider it a real prohibition and therefore cannot take into account the possibility that those who do eat it might show up for a meal – similar to the halacha of kitnios according to the Maharsham.]
Source: Making of a Godol, pages 111-114