It is possible and cheap, but not very convenient, because in most countries the tracks pass through large cities, so if you want to get to some prominent town, you will still need to use a bus. Therefore, if I have free time, it is better to use the bus right away and even enjoy the view.