Portland, ME is just far enough from Boston that it's not feasible to do any regular commute unless you really, really want to live there.
(Edit: I’ve also done the Providence, RI to Boston commute, by rail, which was just over an hour typically.
Don’t forget that commuting works well when your job is near free parking/train/bus. It gets pretty bad when you have to add another 20 minute subway wait/ride in once in town...)
The train is on the Newburyport/Newbury town line, so not quite the center of town... but that’s a quibble. Parking for the train isn’t free either, and tickets cost more than the bus. The busses run more frequently too (they’re smaller, so it’s like breaking one big train into pieces.)