It’s determined by the territories the units are passing through, and at each end, and it for all units for the turn.
In your example, Germany could only get 2 units to Smolensk through Belarus and Eastern Poland, and that uses up all the rail capacity for those territories. If they wanted to deploy a units in Poland somewhere else, they can only transport 2 out of or through Poland (since the move to near Moscow used up 2 of it’s 4 capacity), and none at all through Eastern Poland.
However, and I forget to say this originally, since Bessarabia sits in the middle of the highest IPC values on the eastern front, and has no IPC value of its own, I would give it an exception, and a rail capacity of 4.
Now if Germany did something wise and advanced through southern Russia as well, they could also transport 2 units into Beyansk, via Western Ukraine, ready to join an attack on Moscow (you’d still have had to taken those territories, though.)
At the same time, assuming you went the Slovakia-Hungary to Romania route, you can transport 2 more units into Western Ukraine, using up Ukrane’s rail capacity. perhaps for a drive to the southeast. Or, and even better, those 2 units could be mechanized infantry or tanks, and could still make it to Moscow on their combat move next turn.
Now, assuming Germany sent those 6 units for the eastern front from Germany, that used up 6 of Germany’s 10 rail capacity. If there are more units in Germany that the player wants to send to fight in say, France, only 4 more units could be sent west from there.
This allows units to move up to the front quickly, and attack on the second turn after they were purchased. But at the same time, even if Germany went the 2 mechanized infantry/tanks into Western Ukraine route, they were only able to get 6 units to the front in one turn.
Even if they had the units, and the capacity left in Germany and Slovakia-Hungery and Romania, they can’t send any units to say, Ukraine, since it’s limited by the capacity in Bessarabia, and they can’t send any more to Western Ukraine for the additional reason that it’s capacity is used up - 2 units passing through to Bryansk, and 2 units ending there.
Hopefully that cleared things up.