Some public defenders are gov't employees, where others are private practitioners appointed by the courts to handle certain cases for indigent clients. It is an excellent way to start out a career in law. It's not always just about money. You will be exposed to a wide variety of cases, learn the realities of plea bargaining (most cases don't go to trial), and see how often innocent people plead guilty because they are afraid to take their chances with the judicial system.
Prosecutors are also gov't employees, and of course, they are on the other side, trying to send people to prison or jail. They too are overworked many times, and I have seen them in trial totally unprepared, because the case has dragged out for two years, and changed prosecutors three times.Most lawyers do not stay with the prosecutors office for their entire careers, they use it as a stepping stone, often, to go into criminal defense.
People pay a lot of money for a criminal defense attorney.