Are you certain you can even get temp tags in NJ? Are you buying private party or from a dealer? They may not issue them to a non-resident..but i have never dealt with them before so IDK. If not, maybe NJ is okay with the Mass method of transferring tags that I mentioned above.
If the issue you run in to is MA not honoring those tags then the easy solution is drive right to the MA border and pull over, put on your MA tag and drive the rest of the way home. (again make sure you have Bill of sale and Title with you). As far as your route, the most direct way (at least to the Boston area) is through NY, CT and RI then finally in to MA. It may make sense in this case though, to take a longer route home to avoid legal issues in those states. The best advice I can give is:
1) make sure you can get temp tags in NJ
2) call the DMV and/or state police dept of each state and get their take on driving through
3) choose your route based on the responses from #2
orrrr... just put your MA tags on it and drive really carefully home and don't get pulled over