On top of that, pure and legitimate technocrats frequently are so deep in their fields they don't notice side effects to other fields. Politics are about making the whole system work, not about advancing one single field.
It's easy to optimise a society for a specific task (e.g. war economy). But the disbalance it brings may not be worth it in the long run. E.g. today's western societies are not self-sustainable due to huge welfare and too low birth rate. I wonder wether we'll revert to family-based societies next or invent smth new.
Of course, next step is that welfare to freeriders is cheaper for the society than freeriders turning into criminals. But even with welfare there're criminals and not all freeriders are criminally minded either.
US has a 18.57 trillion GDP, if you dedicate 10% of that into ~1,500$/month free riders that's ~1/3 of society. As long as most people want more than a subsistence level income it's simply not going to become a big deal. Sure, you in theory lose the economic output of the lazy not just the old or the infirm, but that output is simply not that significant in the first place.
Granted, we spend vastly more than that on many people. But, higher costs are a question of poor implementation not inherent costs.