> food wouldn't be produced to be wasted
How do you predict *precisely* how many portions of food you sell tomorrow?
You can't. So either you produce too much (surplus) or too little (Marxian economy). Surplus ("waste") was one of the main points of Marxian criticism of capitalism - so socialism said it will do it better and ended up with totally crap "economy of shortage" (János Kornai).
> the food safety argument makes no sense
Yes, tell that to taxman and lawmakers.