As if the US is the only country. Plenty of EU countries, China, and Japan would invest in developing even higher speed rail options.
It’s very dependent on geography. Ironically the US is a much better candidate for maglev than Europe with its wide unpopulated expanses.
In any case countries that want to spend money on military research just do so, using the budget they allot to military R&D. There's no need to try and hide that you are researching railguns.