If Socialists Understand the Free-Rider Problem, Then Why Are They Socialists?

There was a funny sideshow to the recent Supreme Court Janus v. AFSCME decision.  That decision essentially made it impossible for local or state governments to require that all employees pay support to certain public employee unions, even if they are not a member of that union and/or don't support that union's activities and, particularly, that union's political speech.  Progressives, many of whom feel increasingly confident to admit that they are socialists, rushed to point out that this was a death knell for these unions because of the free rider problem.  If workers who benefitted from the union's collective bargaining activities were not forced to pay, then what incentive exists for any one employee to pay the union if they still will enjoy the benefits without paying.  Soon, everyone will become a free rider and the union will die.  America's most famous socialist Bernie Sanders demonstrates that he understands the free rider problem completely in this

Sanders’ bill, called the Workplace Democracy Act, would remove several of the major barriers to organized labor’s growth.

It would ban “right to work” laws, which allow employees to opt out of paying union dues even though the union must still bargain on their behalf, leading to what unions call “free-riding.”

This is all very ironic.  Socialism fails for a number of reasons, but perhaps the easiest one to explain to laymen is the free-rider problem.  Anyone who has had to do group projects in school likely understands the concept to its core.  If all output belongs to the collective, and is divided up based on need rather than productivity or innovation or even diligent work, then where is the incentive for an individual to do anything?   The collectivization of agriculture in both China and Russia was a disaster (meaning millions died of starvation) because of this free rider effect.  If socialists understand the free rider problem, as they clearly do (at least in Janus v. AFSCME), how can they be socialists?

The answer to my question may also be in this legal case.  For the free rider problems in public unions in this case (and in private unions as well in the Sander plan linked above), progressives intend to use force as a solution.  If people don't see value in the union and don't want to pay, well they are going to have to be forced to do so anyway.  Literally, we will put free riders in jail.  You can probably get away with this solution for a niche issue like union dues is a generally law-abiding country like this one.  But even Stalin and Mao were not successful in getting more agricultural or industrial production at gunpoint, though they killed a lot of folks trying.  And if force did not work on rice production, imagine how well it will work, say, trying to get innovation out of someone's mind when that person has zero incentive to do anything but just show up for work.