A State officer is not liable on his official bond for losses caused by the failure of a bank in which is made a deposit of money belonging to an inmate of a State institution, if the officer was required or permitted by law to act as a trustee or fiduciary with respect to the money and if he made the deposit in good faith and in accordance with law.