There are likely several effects in play.
Firstly, most people have some awareness of their singing competence, and in the average population there are a fair number of reasonable singers (even if they have bad voices or limited range).
In particular, most people can sing tolerably in relative pitch over a small range of notes (that is, they know whether the pitch needs to go up or down, and by roughly how far relative to other notes in a sequence).
In a large crowd, good singers are likely to belt out the notes in the manner expected, whereas inveterate poor singers are more likely than not to moderate their output (or even stop singing altogether) when they do not believe they are subject to attention.
(There was a famous case in the 90s of a politician here in the UK, John Redwood, choosing to mime the words of a Welsh song that he did not know - but because of his individual prominence, he was broadcast on TV anyway gawping like a fish gasping for air).
In a small singing group (or if you're a prominent individual in a large group), this is a less feasible strategy, since all participants will be expected to contribute and be heard (even if what is heard is discordant), and all participants usually can be clearly heard as individuals. So sometimes extremely poor singers, or even momentary mistakes by good ones, will be heard clearly in small groups.
Secondly, there is no systematic bias amongst poor singers. That is, they are on average neither consistently above the correct note nor below.
Poor singers are likely to vary the pitch of a sustained note (that is, sing what should be one sustained note as a fluctuating series of variations around the correct note), they are likely to mis-time transitions, they are likely to sing wrong notes both above and below the correct note, and they are likely to change key unpredictably (i.e. singing the right relative notes, but in changing ranges).
But taken as a whole in the crowd, these errors are unsystematic and will either be heard either simply as noise and muddiness without a distinct character, or will be heard as pleasant and concordant harmonics which add richness (or as acceptable variations in chromatic approach notes, which receive less attention from listeners).
Thirdly, people are much more capable of identifying whether the note they are hearing is correct, and matching their own voice relative to a correct note that is being heard, than they are of generating a correct note independently. As I said at the start, the majority of people are competent to hear and sing in relative pitch, so if they are given a "backing track" to sing along to their performance improves, because they can hear the differences and correct them.
Most choir-type songs proceed relatively slowly (an untrained crowd won't usually be expected to belt out Proud Mary at Tina Turner's pace), which not only gives people more margin to match the correct timing, but more time to find the correct note that they are hearing. It only requires relatively few people interspersed in a crowd to have good timing and pitch, and with the confidence to sing loudly, to provide an anchor for others in the vicinity to match.
So in summary, in crowds poorer singers tend to sing more modestly than average whilst good singers tend to sing more loudly than average, secondly the aggregate error of poor singers tends to approximate noise (rather than a specific audible off-note), and thirdly prominent good singers help to guide the voices of the majority closer to the correct notes. So in aggregate, the song can be heard distinctly above the random noise.