My understanding is that, on paper, to be prosecuted, a few things need to happen:
- Law enforcement needs to raise the issue to a prosecutor
- A prosecutor needs to pick up the case
- A grand jury needs to indite you
- A petite jury needs to find you guilty
- A judge needs to sentence you with a penalty (as opposed to stern talking to)
Each of those is intended as a check-and-balance in the system. All of those have been steamrolled with misaligned incentives, mandatory minimum sentencing, etc., but that's how it's supposed to work.