The Freight vehicle mission becomes available once you complete Yay Ka-Boom-Boom. Any time you see a train at a station, go up to the engine car and hijack it like any normal vehicle. Not that you don't control the train other than accelerating and braking. The goal of the Freight mission is to complete deliveries around the entire state of San Andreas, which is done by stopping into the red marker at the stations.
This can be rather tricky as the train doesn't stop on a dime, plus it can be easy to derail if you're not careful with the speed. The train will begin to shake at around 45 MPH and it will derail on sharp turns at that speed. If you keep the speed at around 40-44 MPH, then you should be fine.
Since the train takes time to stop, when the distance gets to around 300-350, then you should begin holding down the brake. If you pass the marker at the targeted station, then you'll need to reverse until you do get into it. You need to do 5 deliveries to complete Level 1 and then the same to complete Level 2. Once you do that, you will receive $50,000 and be able to ride trains for free. Note that once you have boarded the train and started the mission, you cannot leave the train.