The recipes, the yields per pan, and the waste are all calculated out and priced accordingly.
There is a base line with which the kitchen can use to calculate how much to make, but there is always leftovers and waste.
In a restaurant conversely, the individual plates offered are costed out so as to avoid any discrepancies.
While the 2 examples are basic, high food costs have many variables.
Cafeterias can have low food costs if the variables are watched and controlled.