Title 4, section 7 of the United States Code dictates the position and manner of display of the National Flag. See this helpful guide on the U.S. Flag Code. The Massachusetts Governor can also decide to fly flags at half-staff in the Commonwealth pursuant to
4 U.S.C. sec 7(m) (in relevant part):
In the event of the death of a present or former official of the government of any State, territory, or possession of the United States or the death of a member of the Armed Forces from any State, territory, or possession who dies while serving on active duty . . .
The Commonwealth's Flag Status can be found here. To receive e-mail notifications of half-staff status, please send a request to: