The melakhot permitted on Yom Tov are permitted for the sake of the mitzva of simḥa of Yom Tov. Therefore, one may cook for other Jews, since they too have a mitzva to rejoice on Yom Tov. However, it is forbidden to cook for non-Jews, who have no mitzva to rejoice on this day, or for animals, as it is written: “Only what every person is to eat, that alone may be prepared for you” (Shemot 12:16). The Sages expound: “for you,” not for non-Jews; “for you,” not for animals. For this reason, the Sages tell us that non-Jews may be invited to Shabbat meals, as there is no concern that the hosts will cook extra for them in a forbidden manner, as cooking is prohibited on Shabbat anyway. However, non-Jews may not be invited to Yom Tov meals, as one may end up cooking extra for them (Beitza 21b).
If a non-Jew arrives uninvited on Yom Tov, then if the hosts have finished cooking by the time he arrives, he may be invited to join the meal, as there is no longer a concern that they will cook extra for him. This applies even if the unexpected guest is an important person, as long as the hosts do not insist that he join them (SA 512:1; Taz; MB ad loc. 10).
If one wishes to invite a non-Jew who is interested in conversion to Judaism, he may do so, on condition that it is explained to the potential convert that it is forbidden to cook for a non-Jew on Yom Tov. In this way, there is no concern that the host will cook an additional dish for him, though he may increase the quantity of the existing dishes on his behalf.
A Jew may invite his live-in non-Jewish attendant to join his Yom Tov meal, and he may add food to the pot before placing the pot on the fire. Since the non-Jew is his attendant, the employer is not overly concerned with the need to honor the non-Jew, and there is no concern that he will transgress by adding to a pot that is already on the fire (Rema 512:1; MB ad loc. 11).
The Sages decreed that a Jew who publicly desecrates Shabbat is to be treated like a non-Jew, and consequently one may not cook for him on Yom Tov (MB 512:2). Latter-day poskim, however, rule that this applies only to people who publicly desecrate Shabbat out of spite (lehakhis), whereas the typical non-observant Jew nowadays does not keep Shabbat because he does not properly understand its great importance, not out of spite. Therefore, he is like any other sinful Jew, and one may cook for him on Yom Tov (Peninei Halakha: Shabbat 1:15).
One may not cook for animals. Nevertheless, as we have seen, one who cooks for himself may add some food to the pot for an animal in his charge before he places the pot on the fire (SA 512:3). Other laws pertaining to feeding animals on Yom Tov are the same as those of Shabbat (Peninei Halakha: Shabbat 20:3).
. The question of whether it is permissible le-khatḥila to invite a respected non-Jew to the Seder or another Yom Tov meal for the sake of communal welfare requires further study. See Shulḥan Shlomo, 512, n. 8, which records that it was customary to invite consuls and ambassadors, and that this was permitted because it constitutes a great need. In my opinion, this can be permitted under pressing circumstances only if the hosts resolve to finish cooking all the dishes before Yom Tov, just as is done before Shabbat. In this way, the concern that they will cook for the non-Jew is lessened. This can also be combined with the view of most Rishonim that no Torah prohibition is violated when one cooks kosher food for a non-Jew, since other guests may arrive. Here, since the non-Jew’s entire objective is to join a traditional, customary Jewish meal, there is no concern that one would cook non-kosher food for him, so perhaps there was no decree in such cases. If we accept this reasoning, then we may rule leniently even when circumstances are not pressing when the goal of the invitation is for the guest to experience a properly observed Jewish holiday. According to the same logic, one may be lenient with respect to non-Jews who want to convert or who have already joined non-halakhic streams of Judaism, so as to forge a close relationship that will result in a proper halakhic conversion.