The simple answer is that it can’t. We do the best we can. We provide Legal Services attorneys to those who can’t afford them. There are many lawyers who donate their time, pro bono. But there’s no way you can remove the influence of money from the justice system.
If lawyers are arbitrarily attached to cases, they will be bought after the fact. They will be paid substantial additional fees to do a better job. The rich person will hire their own team of lawyers to “assist” the lawyer they have been assigned. There will be thousands of ways to get around this.
Even if you cap salaries, there are plenty of other ways of supplementing the salaries for the rich. You could provide generous expense accounts. Or bonuses or whatever.
Also, if you capped the amount of money lawyers could be paid, many fewer people would become lawyers. They’d go where the money is, and where the money would be is the ways that rich folks get around the rules of the system.
What we should be doing is working hard to detect and root out corruption. Especially in the judiciary. We should be working to get more money into the Legal Service departments. Perhaps most importantly, we should be working to give people skills to get jobs and to solve their problems without violence. If we reduce criminal justice to a minimum, the rest is family and civil law. Those are different issues, which I am too tired to deal with now.
By the way, most situations that courts have to deal with are civil and family court cases. People think of criminal law, but most money is spent in other legal forums. To equalize the effect of money there is very problematic indeed. Imagine if everyone could file a civil suit and be guaranteed equal representation. Scary, scary.