For decades, localities have pumped money into prosecutors' offices, allowing commonwealth’s attorneys to get higher salaries, more attorneys and paralegals. But officials haven’t done the same for public defenders, leading to widening pay gaps between the two sides of the courtroom.