Buy train tickets much in advance. They are bought up by scalpers very quickly and then sold at triple the price. You can also try to make a deal with a train host and buy a ticket from him or her though in this case the price will be overstated.
This is how you can buy tickets for intercity buses: tell your surname to the bus dispatcher at the bus station, he or she writes it down and ask to pay the ticket deposit. No ticket is given to you. Instead the bus dispatcher tells you where and when you will have to come and where the bus will be waiting for you in particular.
Fees for international trains are higher than inside Russia. So, if you have decided to go to Kazakhstan, buy two tickets: the first one to the last Russian station before the border and the second one from this station to your destination place in Kazakhstan. Do the same when going back.