Those costs are relatively minimal, courts do charge fees (though I don't know how well that covers the court's expenses), and few class action suits go to trial - they are settled or dismissed beforehand.