First, the price for bail is determined based on certain factors like what crime and how serious it was, whether the defendant has a prior criminal record, how dangerous he or she is to the public, and whether he or she is a flight risk.
Second, bail is designed to be an incentive. Bail is refundable at the close of trial but in order for the defendant and/or anyone else who was financially responsible to get their money back, the defendant must go to all court appointments and not violate any other terms and conditions of release like not committing another crime or not getting behind the wheel when their license has been suspended or not missing any counseling sessions. Because there is so much money that can potentially be taken away for good (or potentially all be refunded), the court must make the amount rather high so the defendant is willing to meet all their requirements.
Bail can be very difficult for many people to meet in a fast timely manner. Bail bonds are thus a more ideal alternative for these people. While the fee/ premium the pay to the agency is non-refundable, it is only a small portion of the full bail amount that is paid to the agency on a weekly or monthly basis, not all at once.