There's the judge, their Bailiff and stenographer. There's also a traffic enforcement officer that is to testify about the tickets. That's 4 people's wages and electricity to account for that ultimately end at the government's bill: three via the court and one from general police. Add to that the courtroom building and its maintenance, as well as the traffic enforcement that runs before that. Let's account the totalthat all in bulk for a total of... let's say aboutat the top maybe one thousand an hour at the lowest level. Let's say they manage to run through 6-10 cases an hour, each resulting in a fine that averages to 100 units of currency. That's 600-1000 bucks into the coffers, so maybe breaking even. But it's not into the court's coffers, but those of the government's fines division. It doesn't subsidize the court, so it's a tax on the funds allocated to the courts, while maybe running a slight profit for the government.
Small Claims Court tries to break even for the court.
larger Civil cases aretry to stay mostly cost neutral for the court.
In a civil case, filing and courtroom fees apply. Filing fees are usually per filing, courtroom fees just about cover the maintenance and maybe the stenographer or clerk of the court. In a typical civil case, the lawyers costparty's lawyers' cumulate to at least one to two magnitudes more than the court gets in various fees. This is most visible when a case with fee-shifting is litigated - copyright cases are the best example here.
In a fast case where people just want a judge's signature (e.g. "amicable divorce"), the court can maybe run a (slight) profit, but usually, such a case is neutral, though in high profile or complicated cases, it's costly to the system.
Also, note that people filing their cases in forma pauperis usually can skip court fees, resulting even in small cases at times running a loss.
Criminal Trials are very costly for little (financial) gain, or even more costs.
In contrast, the possible outcomes are a fine for the benefit of the government's bucket, that maybe aremight sum up to about the amount spent, but the longer (=complicated) the trial is and the more high-profilehigher the public interest in it, the less such a payment is likely to cover costs. Again, it'sany fine is not ending in the court's coffers, but with the treasury. Also, detainment time does not add anything to either coffer, but instead costs even more!. However, detainment bills the government, not the court's budget.
Note that only in a few systems a criminal defendant is forced to pay court fees. In fact, some countries, like germany, do repay the defense's attorney's costs and missed wages for court dates if they are found not guilty.