Misdemeanor trials cost $20,000 in an exemplar US county [0]. And that's only for the prosecution... take into account the salaries of court employees (judge, steganographer, etc) and utilities and things add up. Whether that is cheap or expensive depends on what you're comparing it to.
Cost of pleading? Maybe a couple hundred dollars.
Cost of ruining someone's life over a drug charge? Maybe worth tenz of thousands or hundreds of thousands of dollars.
These prices are very regional. New York State spends ~60,000$ per prisoner per year. So, a teen spending 60 years in prison (ignoring inflation) = 3.6 million directly + plus lost wages.
Cost of pleading? Maybe a couple hundred dollars.
Cost of ruining someone's life over a drug charge? Maybe worth tenz of thousands or hundreds of thousands of dollars.
[0] https://www.news-journal.com/news/2011/nov/01/court-costs-ov...