In general, you can buy long guns out of state, just not pistols or AR lowers (as they could be made into an AR pistol). It used to be that you could only buy in contiguous states.
However, there may be state/local laws involving NY & NH that could prevent this is your situation.
ETA: after a little more research, I'm going to say "no"...because of this:
Q: From whom may an unlicensed person acquire a firearm under the GCA?
A: A person may only acquire a firearm within the person’s own State, except that he or she may purchase or otherwise acquire a rifle or shotgun, in person, at a licensee’s premises in any State, provided the sale complies with State laws applicable in the State of sale and the State where the purchaser resides. A person may borrow or rent a firearm in any State for temporary use for lawful sporting purposes.
[18 U.S.C. 922(a)(3) and (5), 922(b)(3), 27 CFR 478.29 and 478.30]
Since you can't (I assume) own it in NY, you can't buy it anywhere.
Here is where I found that info...a thread about somebody from NY wanting to buy a rifle in NH.