If I search for a frying pan, almost everything I see is ads. If I search for some programming syntax thing, maybe there are ads, but they are super low value because they have to overcome what I'm actually doing to distract me into wanting to buy something.
But recipies are one of the few sweet spots where I'm probably much more receptive to actually wanting to buy something. This is good for google, and good for the site owners, so it's not surprising they have much more of an advertising focus