Mostly. You do not pay the lawyer. But some states charge a small application fee to get a public defender. Some states add a court fee later if you are found guilty or if you make a plea. The bigger cost is not money. The cost is what you give up by having a lawyer with 300 other cases. You may save a few thousand dollars up front and then spend years on probation, or in jail, or with a record that keeps you from getting a job.