The owner of the house--that is, you--is responsible for making sure everything is up to code, properly permitted, inspected, and the permits closed out, even if the issues arose under a prior owner. However, if the prior owner represented to you that this was all complete, you could sue him for any and all costs you incur based on fraud; and if the the contract of sale indicated the work was complete, you could sue them for your costs based on breach of contract, too.