It varies so much.
Around here, we call a "required permit" that isn't accompanied by an inspection by one name: "Taxation".
We haven't run into escrow issues because no one can keep track of when anything is built, when permits are required, and they don't validate the inspection and release of those permits. If you're in an area that requires a CO, I get it.. Or if there is a permit validation process. The NEC is always changing, so a house that's compliant this year won't meet code next year - that's the nature of the beast.
The only exception to this is septic - we're near a lake and the existing owner is liable for any changes to a septic system that were not permitted. So when property changes hands, you've got to pump the septic tank, get it inspected, and sign a document that says it's unmodified... If you modified it or it's non-compliant, it's massive liability.
Basically - it varies drastically depending on where you live.
I love it when people say that HOAs "increase value" - in my experience, it's the opposite. No one wants a neighbor telling me what color to paint my house. I literally paid 300% more to GTFU of an HOA controlled neighborhood - and I was on the board...