Yes, the government does own it. But that doesn't make the military socialist. People who think the military is socialist understands neither the military nor socialism. Socialism means collective ownership of the means of production, not "stuff that the government does".
Socialism is a form of government where the product of an individual's labor (not the labor itself, but the products of which that labor produces) belongs to the government or the people as a whole. Socialism is an ideal where every persons labor has equal value, be it a store clerk, computer programmer, surgeon, it's all the same. (wheat, metal, whiskey, computers, jeans, whatever you produce, it all has the same value.) The government owns it and you don't have a right to sell it. The government then redistributes it equally, in theory. That redistribution, in practice, however, can be equatable or completely inequitable.
In order for socialism to exist, something must be produced through labor or effort of some kind. The government would own it And redistribute it. Socialism is absolutely, positively not one group of people supporting another who do no add value through labor.
The military does not, has not and never will produce anything at all. The Government, i.e., We The People, support them in every way.
One might argue that the labor of the military produces death and destruction, but they would be hard pressed to argue for the equal distribution of such a commodity.
If the military were a government, which it is not, it would be classified as a dictatorship of some kind, with a clear chain of hierarchical command. In addition, the military is so selective, exclusionary and discriminatory, to the point of approaching tyrannical, that not even the most tortured interpretation of socialism could apply.
The military is simply an armed branch of the government, which is itself a Democratic Representative Republic, as is all branches of the same Democratic Representative Republic. As well, all members of the military have the right to, and are encouraged to,participate in government as individuals, either through voting as individuals and/or running for office.