Encouraging team-work while discouraging free-riding
I assume that your goal is not just to catch and fail the free riders but to see to it that they actually do the work that will result in learning. 

However, I'll note that having a goal of "sharing the work equally" is unattainable except over time and/or averaged over many different interactions. 

The most radical suggestion here is to flip the classroom so that people do the active work of learning under your observation. Rather then passively "consuming" information in a group and then working to solidify it outside your view, the opposite occurs. Now, you can watch how people are contributing and you can encourage a true exchange of ideas and sharing of skills. 

Note that for large groups flipping is much harder, requiring space and possibly help. But working in groups is easier to monitor than individual work in a flipped classroom, no matter the scale. People help one another and so there is less burden on the instructor and any TAs

But another idea that is less radical is to have students simply do peer evaluations of all group experiences. Students are reluctant to bad-mouth their friends, of course, so you need to use a scheme that they will consider "safe" in their social interactions. In pairs, you can ask two questions. First, what was your partner's chief contribution. Second, what was your own chief contribution. These are done separately. Note that both questions are positive and are less subject to simple opinion. 

In larger groups, say five, I would ask to name the three most important members of the group and to also say why for each of them. The question about your own contribution is also needed. Note that a student who is never given praise is probably contributing less. But I didn't try to reduce these comments to numeric scores. 

Knowing that others will have something to say about your contributions encourages them, I think. 

To make this work you need to have a hand in forming groups so that the same people don't always work together. Different tasks can use different ways of forming groups, but some of them need to be under your control, even if it is just random assignment. 

I would have students answer these questions on index cards so they can be sorted. Now you can look at a set of comments about each student and make judgements as needed, but you also get an idea about who needs coaching. 

My own experience with this is positive. In one case, as student who was not standing out in the classroom was said by his peers to be an outstanding contributor to their project. I wouldn't have noticed it but for these comments and thought he was a bit of a slacker. In this case the work was done outside my view and so would have missed the interactions. 



Note that both of these suggestions are for group work. One of my chief goals for groups was that team members could help each other learn. Not everything a student learned needed to come from me.