Modern liberal democratic states have robust criminal justice systems. The police and the courts are generally reasonably consistent in their enforcement of the laws to all within the state, and punishments prescribed are usually proportional more to the crime committed than to the offender themselves. There are, however, problematic exceptions. The arrest and imprisonment rates for African Americans, particularly men, are disproportionate to their numbers in society, and even to their numbers within the lower socio-economic group that most of them are in (a problem in itself). Similarly in Australia amongst Indigenous Australians, and in New Zealand amongst Maori, this kind of disproportionality arises. Presuming that we cannot blame anything like an innate tendency towards criminality for the difference (and there is good reason to think that we can not do this), the best explanation for these results is some sort of structural injustice within the state.
That is, something about the institutional arrangement of the state disadvantages members of these groups, such that criminal behaviour is a better option (and hence, more often engaged in), than it is for society as a whole. The state, or the arrangmeents made by the state, pushes members of these groups towards crime. Having done so, it then arrests and imprisons them (which again, pushes those subjec tto these sanctions towards further crime). The question is, to what extent should the existence of structural injustices within the state constrain the practice of the police and the courts in punishing criminals? After all, if someone commits a crime due to some degree to the situation the state has placed them in, is not the state (to that degree) to blame, rather than the individual?
A first attempt at answering this question: Minimise penal sanctions as much as possible. Apply them consistently across the entire population for violent and sexual crimes, say, but take heavier account of social standing and the like in minor and non-violent crimes. Attempt to avoid the imposition of additional penalties which lead to further isolation from the structure of the state, such as disenfranchisement.