This is such a dystopian phenomenon, I'm far from an expert but I guess it's a matter of city planning?
And it is not for lack of trying. City planners since at least the 1850ies have been trying to improve the areas surrounding large train stations.