Why? Is the military breaking even, for example? Societies can decide how to spend their resources and it can be subsidies to things people want to have exist.
It is costing money in return for "security" (and some more welfare like things in the US, too, for example). How that is valued is a social/political decision, not one of simple cost calculations - the same can be true for other public spending.