I don't know where you are, but some of the highest paid public employees in my state are police. In fact, median salaries for cops are higher than those of software engineers.
Add the fact that they get generous pensions + benefits, and can retire at 45 and draw from that pension until they die, they have it better than most of the people they police.
It's one of the only professions where you can make north of $250k+ a year doing overtime by sitting in your car playing Candy Crush all night.
Come with a pension and active lifestyle with a club(FoP) and a union in some positions, its ostensibly public service and you get to much more than peek behind the curtain.
Personally, I feel both ways about cops writ large. I feel like we could do a lot better really easily(mandatory body cam recordings please? Our guys literally just take them off.), and on the other hand I get it, they’re doing important work often enough.