A unit moving by rail must be in Move Mode, and can expend up to half its MA in the phase before entraining.
And from 13.3e(3):
No further movement is allowed by a unit after it detrains (per 4.7d).
4.7d covers all types of transport:
Sometimes, however, half MA can be spent by units being transported:
• before when using rail cap (13.3d).
• before and/or after when using Air Transport (14.9d).
• after an ALT landing (18.5h) that requires a roll (but not at all in cases where no ALT roll is made).