You can take NCLEX in any state once you have graduated from an accredited program that's accepted by the state you're going to. State 1 will let you take NCLEX if you graduate from a program that state 1 approves, but then when you move to state 2, state 2 might not accept your RN because state 2's BoN doesn't approve that program.
Short answer, go to school in MA (Welcome! We like it here!) after you check with the NYS BoN that they approve the MA school (they probably will). Then when you are about to graduate, fill out the app for NYS, get your transcript sent to them and all that, and arrange to take your NCLEX there for your NYS license after you move. OR, you can take your NCLEX in MA and then get the NY license by reciprocity and have both. Costs more, though.