Legally, Massachusetts is a commonwealth because the term is contained in the Constitution. In the era leading to 1780, a popular term for a whole body of people constituting a nation or state (also known as the body politic ) was the word “Commonwealth.”
https://www.mass.gov/info-details/why-is-massachusetts-a-commonwealth