The spell lists tend to be heavily weighed toward adventure-useful, and they claim that adventurers are rare, but the worlds are obviously high magic. If for no other reason that the women do not spend their entire child-bearing years bearing and nursing children in order for two to survive on average.
Merely having a lot of clerics who can heal and cure childhood diseases would be a way to do it, but more food, better food, and clean water did more than medicine in our world.
Spells that directly influence crop yields and the like might have to clerical or druidic, but wizards could do things like desalinate lands after excessive irrigation, shore up irrigation canals and create reservoirs, strengthen foundations of buildings, set alarms for doors and the like.
And paladins would be enforcing justice at home as well as gadding about killing monsters. Spells to detect lies in court, to uncover injustice, to enforce the laws of weights and measures, to detect adulteration in the marketplace -- all noble and useful purposes. And ones that would minimize in town adventures. But any plausible world would be aiming to minimize adventures as unpleasant, disruptive, and damaging.
A spellbook loaded up with architecture or irrigation spells might annoy the heck out of the wizard who found it, but it would be only logical.