If you buy a car in Massachusetts and live in New Hampshire, you likely only need to pay tax on the car in Massachusetts unless you register the car in New Hampshire.
This can be done after purchasing from the Massachusetts RMV but it requires completing various applications.