There are still ticket sales in this (and most like this) programs. Usually they only apply to nationals/residents of the city/town, and others have to buy tickets.
In Tallin apparently some of the funding needed came from an increase in municipal taxes. You have to be registered as living in or around Tallin to get the free transport, and a lot of people updated their registration to addresses in Tallin. As a result tax income moved to Tallin (but at a loss to other places).
So a large factor in the cost effectiveness of a free transport policy is the amount that the transport system is subsudied and the ratio of that amount to the budget. In places where the transpost system is mostly funded by taxes (most places in the world, especially Europe & the US) it's easier to introduce as there's less of an impact on the budget.
The benefits & beneficiaries of this policy aren't clear and easy to define as they vary place to place. There's a lot of thinking that it's better to provide free or cheap transport for those who earn less and have to make long public transport journies to work as they're priced out of living in cities.
The whole idea was a mayor's election campaign. Rest of the parties were all against it.
Referendum: ask any population if they'd prefer free transport. There: 75.5%.
The money comes from somewhere. Although Estonia had average less national debt, their infrastructure (health service, education etc) is post2008 screwed like everywhere else.