Dave, appreciate you weighing in, but you're thinking like a Californian! LOL
(Which I can appreciate having hit the EJECT button on CA many years ago.)
Idaho is nothing like California when it comes to stuff like that. If a home is being sold (I am a licensed real estate agent, so I can speak to this) and there is something that is NOT up to code but is NOT flagged in the home inspection or a home inspection is waived (we can do that here), then it won't be addressed by the seller (the one who had all of that electrical work done). If it is flagged, then it typically would need to be brought up to code, BUT the buyer could still allow the sale to go through with those code violations as-is. As to liability, as long as the seller disclosed the items that were not up to code (provided he knew about them), then he is off the hook. Barring that, that is what the E&O (errors and omissions) insurance policy is for. Not saying there is no scenario where the seller would be liable, but the E&O insurance is in place for precisely these reasons. If a code violation was not flagged in the home inspection (or a home inspection was not done) and the sale went through, then it would become the responsibility of the buyer (i.e. new owner) to correct the code violation, unless it is major and he wants to pursue legal action against the seller for non-disclosure, but the burden of proof would be on him to show that the seller knew about it and failed to disclose it. Again, the E&O insurance policy would kick in for that reason. If the code violation was major and someone was harmed or killed, then it almost certainly would go to court and could get pretty harry and could exceed the policy limits of the E&O policy, making the seller personally liable (and possibly the realtor and designated broker, too)!