Is there something in the legal process that allows powerful people to allow to manipulate the legal and political process to get favorable outcomes?
In the specific case of Jeff Epstein, the allegation is that he is a blackmailer who collects money from some of his victims and favors from others. It is worth noting that he has not been convicted of blackmail, only of things related to having sex with minors. Blackmail is thus a speculative explanation of his situation.
The United States (or whatever country) could do better vetting of public officials. If candidates for public office had to face a security check where negative information was then published, it seems much less likely that there would be many who were then able to give preferential treatment to people blackmailing them. Same thing for appointees. Then spot check officials periodically to ensure that they had not become corrupt or vulnerable in the meantime.
Another allegation was that he paid off witnesses. As such, it is possible that he would not have been convicted even if brought to trial. This is harder to prevent, as it is already illegal. It is possible that sufficient resources would have been able to catch either his agent or he himself paying off the witnesses.