A little Info
In answer to your logical/feasible question, I would say neither, but it can be, and has been. done in much shorter periods of time......with the caveat being it leaves very little time for any off the beaten track stuff and any real interaction with locals, nor any first hand knowledge gathered of the differing local culture and history (except at the bar at night and little snippets at fuel and food stops).
That being said, It's still a hell of a ride and will always be better than not doing it, be it logical, feasible, or fiscally responsible. Go for it. Sometimes a ride is just that.
If buying in New York, Do your homework ahead of time. Buying the bike should be fairly straight forward. Try and have the deal lined up (or well as can be expected given your abscense) before you arrive in order to waste less of your precious riding time.
Remember to get free title to the bike at time of sale.
All states recognize other states vehicle titles for registration purposes. Some faster than others.
It will be quite easy to transfer the bike (sell) in regards to paperwork and legalities (if bought in New York). Alaska has a long history of out of state motor vehicle title transfers due to a lot of transient military and the nature of "Lower 48" immigrating oil industry and governmental employees transferring up here, as well as a large summer employment segment that services the tourism and fishing industries.
As for selling the bike, we have an active Craigslist community and also the AKlist (a local version of CL).
I would stop in a local internet available place along the way, first taking a picture of your bike, and list it on Craigslist on the Friday or Saturday before your arrival (usually the days with the most CL site traffic), giving an "available date" in the listing. That way you will quite possibly have someone waiting to buy it, or at least interested in it, even before you arrive. You can converse back and forth via email, while on the road, with potential buyers.
Alaska has a relatively limited riding season, more or less, depending on how big a lunatic rider you are.
The later into the summer you arrive, the harder it will be to sell here to the local market. That being said, a good deal will always be a good deal, so if priced aggressively for sale, it will sell no matter what.
So finding "the good deal" on the New York end of things will be the most important part of your whole motorcycle buying/selling experience.
If necessary, due to your being pressed for time, you can leave it with me and I'll wire you the money when it sells. I'll be shipping my own bike over your way next season to ride the Isles and Continent, visiting lots of family all over (my father was born in London) so you can just buy me a pint for my trouble when I show up.
Let me know if you have any other questions.