Section 4D. Any governmental unit, as defined in section four A, may enter into an agreement with the commonwealth or with any public authority, whereby the commonwealth acting through a duly authorized agency, or such public authority, will perform for such governmental unit, any service or activity or undertaking which said governmental unit is authorized by law to perform for itself.

All bills submitted for payments on account of work done under such agreement shall be plainly marked to indicate that the work was done under authority thereof, and payments at such intervals as provided by the agreement shall be made to the commonwealth or the public authority or upon direction of the commonwealth or the public authority, at such intervals as the government provides, directly to the contractor performing the work under agreement.

Any such agreement may provide that such governmental unit pay to the state treasurer or to the treasurer of such public authority, as the case may be, its respective share of the estimated cost of the work to be done, and that the state agency or public authority which is a party to the agreement be authorized to expend the money for the purposes for which the payment is submitted. The provisions of sections twenty-six to twenty-nine, inclusive, and of sections forty-four A to forty-four L, inclusive, of chapter one hundred and forty-nine, and the provisions of sections thirty-nine F to thirty-nine M of chapter thirty, shall apply to all such work performed by a public authority to the same extent and in the same manner as they are applicable to the commonwealth.