It's simply making magic rare.
First edition D&D you had to roll to see if you could learn a spell, and it burned your chances for a serious amount of time. And that was if you could find the spell. They were not easy to locate. It would be a reason to adventure in itself, trying to locate spells. They don't' have to be available in shops. And, of course, given their precious character, no wizard would lightly throw away his advantages. Perhaps kings would force the wizards in their service to share spells, or research new ones, but that would only alleviate it.
Clerics, of course, are even easier. I read a discussion once about taking D&D spells seriously, like what would the effect of widespread create food & water spells?
Fortunately, that's easy to answer: the god of agriculture would be ticked off. Or whatever scores of gods and goddesses of various aspects of agriculture, who would make up in number what they lack in power. Even a monotheistic game world would have a reason why there are farmers, and it's unlikely it was just to bide time for clerics.
Leaving aside divine politics, if you are taking it seriously, the spell derives from his sphere. And if you are taking it seriously, you need some serious explanation of why a cleric of another god can call on his sphere, and it's unlikely that he has no choice. Most serious would be that the cleric pays proper devotions to all the gods (which is the real world polytheistic approach). The god would make it clear that the cleric is not to try to short-circuit the process. Perhaps the food would be bland, or bitter, as a warning, and then the spell would simply not be granted.
Exceptions might be granted for dungeons if they are otherworldly. Still, the god might require parties to take reasonable provisions and only resort to the spell after that. Failure to do that might start with the party having to forage or buy food as they trudge back from the dungeon, but that would only be the start.
Famine and other things -- well, if it's caused by evil magic, perhaps the clerics can cast freely. But if the god is sending famine out of anger, the cleric's spell simply will not be answered until the cleric has led the people to make proper propitiation and amends. (And if it's the god of storms with floods and the like? The cleric will have the task of sorting it out.)
And if it springs from mundane causes, particularly large ones, the non-adventuring cleric is probably the one to handle it. With an agricultural research station of some kind. Perhaps including research into spells, for instance, to prevent problems caused by salt from irrigation. Widespread create food and water would be implausible.