I’m going to disagree with your premise.
Yes, there are inequities. No question.
But I would argue that, in general, they are (a) not gross inequities and (b) they do not define our criminal justice system.
To a large degree – even to an overwhelming degree – the criminal justice system works. The bad cases get more publicity, which is why you use terms like “gross inequities”. But by and large, justice is done.
If you narrowed your generalization – maybe by asking “why are minorities seemingly the victim of inequities in the justice system?’ you might get me to agree. But as asked, your question is far too broad, and in my mind, inaccurate and unfair to the justice system.