Usually though, what we have in the US is that foodwaste goes to landfills (bad), and then lawns are grown with fertilizers (instead of compost). That's a much larger carbon cycle that ends up depleting the land in multiple ways. Let's not even get to how wasteful we get with water management -- pumping water, purifying them to drinking water standards, and then watering lawns with them.
How strictly is that enforced? And is it applied without exceptions? For example I compost but if I have something oily I'm going to compost it because oily soil isn't great.
Anecdotally, I’m a CA homeowner and this is the first I’ve heard of it.
Seattle has something like that too, when I lived there seven years ago. We were provided bins for composting, and compost bins were in every resturant I went to.
https://www.jdsupra.com/legalnews/new-california-compost-law...
It also depends on how you are composting. The main problem with composting oily food is that the oil goes rancid. There are solutions for that.
Black Soldier Flies Larvae can eat that stuff, and are symbiotic to human activity. (They stay in one place, drive out the other species of flies, and don't go after humans). If you have a red earthworm composting bin, you'd feed the BSFL stuff that you don't want to feed the worms. (You'd feed the worms the best stuff and give the rest to the BSFL).
Industrial composters will just throw them all in big piles and they will eventually compost. Some might implement ideas from Paul Stamets and cultivate fungi on the heaps to help it break down faster.