I'm going to assume by the tenor of your question that you are the seller of the property and are now being asked to fix the home. If that is the case, then the advice to you is to talk with a qualified real estate attorney regarding your responsibility and rights in this matter. Depending on the information and structure of your sale, you may have some or no culpability, but only an attorney can tell you that.
If you were the buyer in this matter, however, and KNEW of the code citations, it would seem unlikely that you can or will be able to get the seller to pay for the repairs to the home. But again, only an attorney can truly answer those questions for you.
Most importantly, however, for anyone interested in buying a home with known, suspected or possible building citations or with areas within the home that have been built without a permit.. the admonishment is "caveat emptor"--let the buyer beware because what you think is a bargain may bite you with equal vigor in the posterior end of your wallet.
Good luck and consult and attorney post haste!
Allison James Estates & Homes
Buyer Rebates and Low Cost Listing Commission to Sellers