We should also be careful to analyze Starfleet separately from the Federation in general. The quasi-military part isn't going to necessarily be the same as the whole.
Kind of like how in real-world US military is a socialist system, encased inside a larger economy and political landscape which is much less so.
Kind of like how in real-world US military is a socialist system, encased inside a larger economy and political landscape which is much less so.