Since we fulfill the mitzva to rejoice on the festival through festive meals, on Ḥol Ha-mo’ed it is permitted to do any melakha necessary to prepare food. This permission includes both skilled labor and demanding work. True, on Yom Tov one is also permitted to do melakha to prepare food, but there is a significant difference: On Yom Tov, melakhot that one generally does at home, such as cooking and baking, are permitted, whereas on Ḥol Ha-mo’ed, all melakhot necessary for food preparation are permitted, including those generally done in fields or factories. Also, unlike Yom Tov, when it is permitted to do melakha only if the food will be eaten on Yom Tov itself, on Ḥol Ha-mo’ed it is permissible to prepare food for the entire festival, and even for the next Shabbat if it immediately follows Yom Tov (SA 533:1).
Therefore, on Ḥol Ha-mo’ed it is permissible to pick fruits and vegetables, package them, and transport them to grocery stores and markets. It is also permissible to pay workers for their work, to write receipts, and to keep whatever records the law requires. Modern machines may be used to facilitate picking and packaging, as skilled labor is permissible for food preparation (MB 530:1). Animals and fowl may be slaughtered, koshered, and transported to stores for festival use.
Even melakhot that could have been done before the festival may be done on Ḥol Ha-mo’ed for food preparation. The Sages did not want to limit food preparation in any way, as that might detract from the joy of the festival (SA 533:1). However, le-khatḥila, if possible it is preferable to prepare the food in the fields and factories before the festival, so that one will enjoy as much free time as possible on the festival.
When melakha is done as part of selling food to the public and people seeing it might mistakenly think that the work is being done for after the festival, it should be done discreetly, so that the prohibition of melakha on Ḥol Ha-mo’ed will not be belitteled. However, if it is clear that the work is being done for festival needs, it is not necessary to do it discreetly. Therefore, people who work in bakeries, including the salespeople, may work openly, as everyone knows they are preparing fresh baked goods for the festival. But those who work in factories where candy or canned goods are produced should work discreetly even though they are preparing food for the festival, as it will not be obvious to those who see them that the work is being done for the festival (SA 533:5; 537:15; Levush ad loc.; SSK 66:13).
One may not do melakha on Ḥol Ha-mo’ed for the days after the festival. However, it is not necessary to measure precisely how much is minimally required to make it through the festival. Rather, generous amounts of food may be prepared for the festival, and any leftovers may be enjoyed freely. This is on condition that one does not act disingenuously, pretending that the food is being made for the festival when his true intention is to cook for the days following the festival (SA 533:1).
A farmer who grows fruits, vegetables, and grain in his fields may pick them for himself on Ḥol Ha-mo’ed, even if he could buy them in the grocery store instead (SA 537:15).