I work right next to a large railroad... my boss walks his dogs down the Railroad right of way every day, and on the occasions when I've walked the dogs for him, any people that I've seen just waved at me.
Yes, it's trespassing, but if you're out of the way, and make it obvious you're just passing through, generally they won't do anything.
This, of course, varies by area. If they've had problems with people in the past, they'll be sticklers about the no trespassing rules... if not, and you're not on or very near the tracks themselves, they'll probably leave you be.
__________________
"There is no greater wonder than the way the face and character of a woman fit so perfectly in a man's mind, and stay there, and he could never tell you why. It just seems it was the thing he most wanted." Robert Louis Stevenson