A company that won a tender to transport donated rolling stock sub-contracted the job for a much lower price and misappropriated millions, prosecutors say.