If the director, with a view to restoring the solvency of any bank which the department has taken possession of pursuant to law, approves a contract or plan whereby the bank is permitted to receive deposits and pay checks and do a limited banking business, entered into between the unsecured depositors and unsecured creditors representing eighty-five percent or more of the total amount of deposits and unsecured claims of such bank on the one hand and the bank or its board of directors on the other, all other depositors and unsecured creditors shall be held subject to such agreement to the same extent and with the same effect as if they had joined in the execution of the agreement, and their claims shall be treated in all other respects as if they had joined in the execution of such agreement in the event such bank is permitted to reopen for business as limited by such contract. All deposits received after the adoption of such plan and the assets of the bank created thereby, and before the restoration of the bank to solvency, shall be a trust fund for the security and the repayment of the deposits so received and shall not be subject to the payment of any deposit, debt, claim, or demand of the bank previously created. Such money and assets shall be kept and invested in the manner directed by the director. Section 8-138 does not apply to banks operating under this section. Any county, city, village, township, or school district through its governing body, and the state through the Governor, may enter into such contract except when the funds of such county, city, village, township, or school district are adequately secured. Whenever a bank is permitted to operate under the provisions of this section, such bank shall pay all costs incurred by the department in the approval of such plan, including examiners' expenses, attorneys' fees, and clerk hire, and incurred in special examinations required by the director.