Intelligently conceived and enforced building codes are a necessity as too many builders, usually through ignorance, do something stupid.
About 25 years ago, when my ex-house was built in York county, PA, underground electrical service was just becoming into popularity. And it is much, much nice than those ugly overhead lines that are a problem. So the builder simply digs a trench, throws in the new wires, and fills it in as quickly as possible(scrap, beer cans, ect) - remember , time is money.
Now about 15 years later, I observe my nice wall clock running backwards!!
Yes, that and other damaging electrical "shorts and opens", then, no juice! Quite the mystery as to what really occurred to set this off. Turns out that the electrical supply company discovered that sharp rocks in the trench had slowly but surely cut through the insulation on two leads and that electricity was leaking from one wire to the other !!
In Lancaster county, the underground wires must be surrounded with sand, this is a good method of protecting the leads.
And this is just one more thing for home buyers to look out for.