How can you be responsible for code violations on business property discharged in bankruptcy in 1997 if the mortgage holder will not foreclose?

You are responsible as long as you are the legal owner of the property, Bankruptcy usually discharges certain debts including property related debts. If the mortgage company chose not to exercise their foreclose options then you may still be the legal owner of the property. Depending on the property valuation the mortgage note holder may have determined it more profitable not to proceed with a foreclosure process.

Additionally; If fines were already issued prior to a foreclosure, you would still be liable for payment of those fines as well.