A man from St. Johnsbury, Vt., was ordered Thursday to spend three years in prison for buying heroin in New Hampshire and selling it in the local area.