Rail chiefs set for £30m profit after selling firm