In the event of a total or partial loss of any building on which the State Fiscal Accountability Authority carries a loan for the installation of a nationally recognized hazard reduction system, there shall be deducted from the amount of insurance payable, and credited on such loan, a proportion of the loan equal to the proportion which the amount of the loss payable bears to the total amount of insurance carried on the building or, in the case of institutions where insurance is carried on two or more buildings, the deduction and loan credit shall be a proportion of the loan equal to the proportion which the loss payable bears to the aggregate insurance carried on all such buildings. A provision to this effect shall be embodied in each loan agreement.