Section 9. The supreme judicial and superior courts shall have like jurisdiction of civil actions brought by the attorney general against a person holding or claiming the right to hold an office or employment, the salary or compensation of which is payable by the commonwealth, a county, city or town.