It is useful to have lots of stupid laws. It makes people feel powerless and frustrated. It means the police can always find excuses to persecute you.
The technicalities of the individual laws are not important. It’s the psychological effect of the whole body of laws on a people.
For private business the tickets are to fund the business. But for public transport they are never expected to cover the costs of the business.
It is run as a public service, not to make money. The function of tickets is to prevent overcrowding.
That’s why in well designed systems, the price is different at rush hour, and for high traffic routes and times.
I don’t know anything about montpellier specifically though.