system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What is the purpose of prison bail? If somebody should or shouldn’t be jailed, why make it contingent on an amount of money that they can buy themselves out with?

Edit:  Thank you all for the explanations and perspectives so far.  What a fascinating element of the justice system.

Edit:  Thank you to those who clarified the “prison” vs. “jail” terms.  As the majority of replies correctly assumed, I was using the two words interchangeably to mean pre-trial jail (United States), not post-sentencing prison.  I apologize for the confusion.
gpt
Bail is for when a person has not been tried or convicted yet. It's basically collateral to ensure that the person shows up for trial. If they fail to appear, the bail money is forfeit. If the court decides that a person is likely to flee or just not show up, they will deny bail and hold them until trial.