I don't think there is any liability for Court costs in most criminal cases - these costs are costs applied for by the prosecutor.
The CPS has a standard scale of costs which they apply for on conviction.
Other prosecutors (TOCs, RSPCA, Councils, etc) have their own scale of costs to bring a prosecution. The defendant and the bench can challenge these and ask for a breakdown and justification. In many cases, the costs and surcharges far exceed the "means tested" element on a financial penalty, which makes the notion of means testing laughable.
For example, the first-time offender, on benefits, pleading guilty to a minor offence, such as a Byelaw offence, above the threshold for a Conditional Discharge:
Fine £40
Victim Surcharge £30
CPS Costs £85
Total £155 + compensation, such are fare evaded or goods stolen or damage caused.
CPS is a police prosecutions factory, the TOCs will claim that their processes are more complicated and they have to also cover the costs of their own investigations, hence their higher charges.
Anyone convicted now should think themselves lucky that they were not convicted in the period in 2015 when the Criminal Courts Charge was brought in by a certain Mr Grayling. That was an additional £150 and upwards on any sentence in the court, more if it went to trial. Many magistrates resigned in protest and the unfair charge was withdrawn.