Sorry, PN, I tried to say it in one short line which failed.
What I mean is that the military, when it's not fighting, is a waste of money in a sense but we pay for it because we might need it and it has a deterrent effect.
Isn't the ability to produce and maintain weapons also a necessary part of warfare? Why would we not be prepared to "waste" some money on it in the same way - because we might need it, because when other people know we can come up with improvements, can maintain our equipment and invent new things then they will be less certain of the limits on our ability.