A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
Translation: In order for an independent free state to securely exist, the state must control a well regulated militia for defense.
Thus for the people to remain free of state tyranny, the people must be able to keep and bear arms in the event of said tyranny.
Also "A free state" is the state of being free.
Not Massachusetts being free.