The German U-Bahn has a brilliant solution to this. No turnstiles or gates, you're just expected to have a ticket. The penalty for getting caught without a ticket is considered sufficiently high to make "Schwarzfahren" statistically more expensive.
The social stigma, unpredictability and inconvenience of having to pay the fine is a big part of it (not having a ticket is just stressful). Another part is that you don't need to prevent freeriding, nor recoup all the lost ticket sales. You just need enough of a nudge to keep most people honest most of the time.
Obviously "not having too many unauthorized riders" is a very different objective from "only allowing authorized access and refusing all else".
Nuisance riders are: disturbing peace, damaging proprty, assaulting passengers or staff.
Police behaviour, not fares.
(And have social and justice systems which can effectively deal with individuals in need of help or discipline / isolation.)