STEM people in science (used to) populate places like NIH, NSF and other granting agencies. Theh were project managers responsible for funding decisions, or actual researchers. Remember that people used think that pharma just did marketing with all the new drug ideas coming from academia or government labs? Well, these people were either the ones paying the academic labs or actually generating what pharma marketed.
They also were the project managers and researchers in places like NRL and ARL, the premier research labs in the Navy and Army. Guiding weapon development along with the blue/green suits. They staffed DOE labs doing funding and research for things that went bump in the night, cleanup, energy development, etc.
PhD's are the psychologists on staff in the VA helping glue veterans back together. They're also the -ologists (immune, endocrine, ...) who work with the MD's to diagnose and treat people. They also review new drug proposals to make sure they're tested for safety and effectiveness.
There's probably some salted through the other departments doing things like agronomy, geology, ... Things that help food and energy production. There's more than you think in the various security agencies - people were surprised why the government was hiring for computational linguistics back in the 80's. They also handle funding for things that turned into that Net/Web thingie you're using to read this.
Is it useful to have these kind of people on the public purse? Depends on whether you think funding research, regulating drugs, weapon research and cleanup, treating patients, ... are important. They're cheaper than the corresponding private individuals would be if they were contractors or being paid externally.