The term "prosecuted" is used for criminal actions. I think its clear the new owner didn't do anything here, so they are not criminally responsible. They aren't going to jail.
"...would the new owner face consequences now that they are the owner of the property?"
Ownership means responsibility. If you are the owner of the property, you are responsible for maintaining it up to current rules. If the property is out of compliance (even due to a previous owner), you are responsible for bringing it back into compliance.
Recognizing the role of the prior owner, the town council (or whatever responsible body), would probably give you a notice and some leeway to come up with a plan. But if you aren't forthcoming with a corrective plan, or your plan is too slow or inadequate, they can escalate to fines, penalties, and even condemnation or seizure of the property. You won't be criminally prosecuted. But you cannot just claim "not my problem" either.