Because mob justice never happens in the absence of the law.
Discussion
Mob justice is rather unpleasant, and communities, even frontier mining camps, tend to develop formalised legal systems pretty fast.
People don't need to agree on the outcomes, but the overwhelming majority do need to agree on process.
States get in the way of this, and impose systems responsive to the needs of power seekers in the metropole rather than the actual justice-seekers and their communities.