Section 91. (a) No person while receiving a pension, disability pension or retirement allowance from the commonwealth, or from any county, city, town, district or authority shall, after the date of his retirement be paid for any service rendered to the commonwealth or any county, city, town or district, except upon his return and restoration to active service as ordered by the appropriate retirement board after reexamination in case of retirement for disability, for jury service, for services as a retired chief justice or associate justice under the provisions of section twenty-four of chapter two hundred and eleven, for services as a retired chief justice or associate justice under the provisions of section sixteen of chapter two hundred and eleven A, for services as a retired justice under the provisions of section fourteen of chapter two hundred and eleven B, for service rendered in an emergency under section sixty-eight, sixty-nine or eighty-three, for work as an election officer relating to a state or municipal election, for service in a public office to which he has thereafter been elected by direct vote of the people; provided, that the position from which the elected official retired was not a public office to which the elected official had been elected by direct vote of the people, unless at least 1 year has passed from the last day the elected official held said public elected office, for service rendered as an appointee under section sixteen of chapter two hundred and eight or section fifty-six A of chapter two hundred and fifteen, for service rendered when recalled under section fifteen A of chapter twenty-three, for service in a confidential capacity under section seven of chapter thirty in the executive department, or in the department of the state secretary, the state treasurer, the state auditor or the attorney general, for services rendered as an auditor or master by appointment of the probate court, the superior court or the supreme judicial court, for contractual service, or service as a nonemployee, rendered to the general court, for service as a physician, or as a member of a medical panel or similar board under this chapter, aggregating not more than thirty days in any year, or for emergency service for a period not to exceed one year in any position after certification that an emergency exists, that a vacancy exists, and that no person having the same or similar skill is available for such position, which certification shall, in each instance, be made by the appointing authority and, if the position is subject to the civil service laws or in the case of a state employee holding a position not subject to the provisions of chapter thirty-one, by the personnel administrator, in the case of a county employee, by the board of county commissioners, in the case of a city employee, by the city manager in a city having a Plan D or Plan E charter and by the mayor in any other city, and in the case of a town employee, by the board of selectmen; provided, that there shall be deducted from the compensation for the services of any person employed in a confidential capacity or for emergency service other than service rendered in an emergency under section sixty-eight, sixty-nine or eighty-three, as aforesaid, an amount equal to the retirement allowance or pension received by him. The limitation of one year for emergency service, as set forth in the preceding sentence, shall not apply to such emergency service by a physician or registered nurse in the departments of mental health, developmental services or public health, or in any of the institutions of said departments, or at the Soldiers' Home in Massachusetts or the Soldiers' Home in Holyoke, and any such physician or nurse may at the end of each period of such service, upon like certification, be reappointed for another period not to exceed one year; provided, however, that such emergency service shall not exceed five years in the aggregate. Notwithstanding the foregoing provisions of this section or similar provisions of any special law, a person who, while receiving such a pension or retirement allowance, is appointed for a term of years to a position by the governor with or without the advice and consent of the council or by the mayor or city manager of any city with or without confirmation by the city council or is elected for a term of years to a position by the city council, or is appointed to a position in a town and serves in such position under the direction of the selectmen thereof, or is appointed, chosen or elected to a position by the general court, shall be paid the compensation attached to such position; provided, that he files with the treasurer of the governmental unit paying such pension or allowance, a written statement wherein he waives and renounces for himself, his heirs and his legal representatives, his right to receive the same for the period during which such compensation is payable. In this section the words ''general court'' shall include any committee thereof, either branch thereof, any committee of either branch, and any special commission established to make an investigation and study of any matter and report thereon to the general court.
(b) In addition to and notwithstanding the foregoing provisions of this section or similar provisions of any special law, any person who has been retired and who is receiving a pension or retirement allowance, under the provisions of this chapter or any other general or special law, from the commonwealth, county, city, town, district or authority, or any person whose employment, in the service of the commonwealth, county, city, town, district or authority, has been terminated, under the provisions of this chapter or any other general or special law, by reason of having attained an age specified in said general or special law or by the rules and regulations of any department or agency of the commonwealth, county, city, town, district or authority without being entitled to any pension or retirement allowance, may, subject to all laws, rules and regulations, governing the employment of persons in the commonwealth, county, city, town, district or authority, be employed in the service of the commonwealth, county, city, town, district or authority, including as a consultant or independent contractor or as a person whose regular duties require that his time be devoted to the service of the commonwealth, county, city, town, district or authority during regular business hours for not more than nine hundred and sixty hours in the aggregate, in any calendar year; provided that the earnings therefrom when added to any pension or retirement allowance he is receiving do not exceed the salary that is being paid for the position from which he was retired or in which his employment was terminated plus $15,000; provided however that in the first 12 months immediately following the effective date of retirement, the earnings received by any person when added to any pension or retirement allowance the person is receiving shall not exceed the salary that is being paid for the position from which the person was retired or in which the person's employment was terminated.
(c) Each person referred to in paragraph (b) shall certify to his employer and the treasurer or other person responsible for the payment of the compensation for the position in which he is to be employed, the number of days or hours which he has been employed in any such calendar year and the amount of earnings therefrom, and if the number of hours exceeds nine hundred and sixty, in the aggregate, he shall not be employed, or if the earnings therefrom exceed the amount allowable under paragraph (b), he shall return to the appropriate treasurer or other person responsible for the payment of compensation all such earnings as are in excess of said allowable amount. The amount of any excess not so returned may be recovered in an action of contract by the appropriate treasurer or other person responsible for the payment of the compensation of any such person.
(d) Any person who is paid for any service rendered in any employment, permitted by this section, shall not, except upon his return and restoration to active service as ordered by the appropriate retirement board after reexamination in case of retirement for disability, be eligible to membership in any retirement system established under the provisions of this chapter or any other general or special law, except as provided in paragraph (g) of subdivision (1) of section five.
(e) Notwithstanding the provisions of paragraphs (a) to (d), inclusive, in any period during which there is a critical shortage of certified teachers available for employment in a school district, said school district may employ as a teacher or as a mentor to other teachers any person who has retired from the teachers' retirement system or the Boston retirement system. Any such retired person who renders service in a public school district as a teacher or as a mentor to other teachers shall be subject to all laws, rules and regulations governing the employment of teachers in the school district. Such person shall not be deemed to have resumed active membership in the teachers' retirement system or Boston retirement system and said service shall not be counted as creditable service toward retirement; but in the first two years immediately following the effective date of retirement, the earnings received by a teacher who retired pursuant to subdivision (4) of section 5 when added to any pension or retirement allowance he is receiving shall not exceed the salary that is being paid for the position from which he was retired or in which his employment was terminated.