The problem is that there are only so many viable paths between cities. Rails is worse than roads in this case because turns can't be as sharp and grades can't be as steep.
When there are potentially tens of thousands of property owners along that path, each property owner can derail the whole thing or add enormous costs, so they have an insanely strong negotiating position. If you were just to attempt to negotiate with each property owner, the cost would make building new rail in a populated area impossible.
There has never been any real length of railroad built through a populated area with many landowners without some kind of government intervention akin to eminent domain.