Many government agencies make no money, as they’re not profitable organizations (I’d argue the entire government is de facto a non-profit organization but that’s a separate argument). The few that are able to make money would typically do so for their own ends (like taxing gasoline for maintaining roads). The IRS is one of the few organizations that generates income for the government specifically to spread across other agencies.
What’s insane to me is people talking about this like there’s no ceiling to how much money the IRS can take or that if the IRS went to $0 per employee that would somehow be a good thing. It’s the same thing when people say NASA generates income for the country therefore we should fund it more. Be intellectually honest with yourselves, if we funded the IRS or NASA or any other entity that makes $X/employee, there is a point where that funding becomes suboptimal. And I’m not seeing anyone discuss what the optimal amount is here, it just seems like you think the amount is “more” because taxing people is “good.”