There is no single answer to this. After nearly 200 years of railroad history in the US (and that's assuming you're even speaking of the US), lots of land has changed hands. But, generally speaking, the railroads own the land on which their track is laid and a significant easement on each side of a couple-hundred feet.