I'm not aware of code violations being recorded on the title.
A code violation can be easy or nearly impossible to fix. For example, a homeowner may have added an additional bedroom or a porch to a home and it's not up to code. The two options are to bring the bedroom up to code by correcting the deficiency, or to remove the bedroom. Or a person may have added a second kitchen to a home and didn't do it to code. Again, the solutions are to bring it up to code or to remove it.
Some new construction near me was built in violation of code--it exceeded permissible height limits. They could have been brought up to code by lowering the roof by several feet (not practical), by tearing down the homes (not politically feasible), or by changing the code and the way maximum permissible height is calculated. (Instead of measuring from ground to rooftop, the code was changed to define maximum height as the "average" roofline height, thus bringing those houses into code.
Once you've determined what the code violation is, you need an expert in the right field (plumber, electrician, mechanical engineer) to advise you on whether the code violation can be corrected, and how much it'll cost.
Yes, code violations often are a big hassle to fix. But that's actually good; the fear of hassle scares lots of potential homebuyers away, and allows you to make a lower offer.
Hope that helps.... more