The system used to be that, when a party won an election, they'd fire the existing government employees, and replace them with members of their party. "To the victor go the spoils", and this was called the "spoils system". But that meant that the knowledge of how the day-to-day government functioned got lost after every election, which was non-optimal. So laws were passed to eliminate that practice, but at the price of making it hard to fire government employees. (Add in public sector unions, and it gets even harder.)
(I don't at all object to being downvoted. But if I'm thinking incompetently or writing badly or being obnoxious or something, I'd like to know what's wrong so that I can fix it. And I haven't been able to figure out what's downvote-worthy in the parent of this comment.)
How can that be, given what Milton Friedman says? Two reasons. First: there are incentives in place to encourage them to do it. If they buy useless things or spend too much money, someone may notice and they may lose their job. If they find a particularly good bargain, they may be rewarded. Second: most people are not perfectly selfish utility-maximizing homo economicus, and even when spending "somebody else's money on somebody else" they do in fact prefer to do so in a way that benefits the second somebody-else at not too much cost to the first one.
Guess what? Much the same applies in government. Suppose you're a doctor in a nationally-run health system like the UK's. You examine a patient and prescribe a drug. Does the fact that you're spending "somebody else's money on somebody else" really mean that you won't prefer to prescribe a drug that actually helps the patient's problem? Does it mean you won't prefer a cheaper drug over a more expensive one that performs no better? Of course not. And if in fact you are the way Milton Friedman professes to be -- if you prescribe with blithe indifference to whether your patients live or die and to whether your national health service goes bankrupt -- then there's a real risk that someone will notice and you'll be out of a job, or pilloried in the newspapers, or something similarly undesirable.