Here are a few ideas:
1) Create a rail-only restriction and a road-only restriction on your network. If you know in advance where your input points are located (on the roads, on the rails, or on both), you can turn on or off the appropriate restrictions before running the analysis.
2) On the features that connect the rail lines with the road lines, invoke a large impedance penalty to discourage transitions between the two. This way, it's very likely that two points on roads will use only roads for the route, two points on rails will use only rails to connect, but a point on the road and another point on the rail will be forced to make a transition somewhere even though it's penalized.