In my state, a foreclosure sale is several steps away from being evicted. After the sale the sale must be approved by the court. After the approval a redemption period must run. After the redemption period the new owner has rights to possession. Those rights must be asserted in a particular way. If you do not voluntarily depart the premises a legal action must take place to before the sheriff will visit with a request that the occupant leave.
There might be a PIRG (Public Interest Research Group) in your area with more specific details for Mass.