Consider that most, if not all, of these developed nations can afford the services you listed because America has vowed to protect them with it's military power.
We spend on military force so they don't have to. The money they save is used for the services you listed.
We could renegotiate, which is what President Trump is doing, yet Id guess Americans want to have the worlds largest and most advanced military. "He with the biggest stick" mentality.