This is a pretty important thing to understand for prep school as well as college because it happens at both.
No school is clairvoyant enough to know exactly how many of the students who are offered admission will attend. They all have good algorithms for predicting yield, but that’s it. And no school has the ability to add 50 more beds if there’s a miscalculation and they end up terribly over-enrolled, so the general practice is to err on the side of under-acceptance and then fill all beds (but no more than all!) by going to the WL. Most schools are happy to have a reasonably sized WL so that to the extent that they have empty beds, they can fill them in a way that maintains the balance they planned for the incoming class. Think of this as a perfect enrollment-management tool.
Remember that some students will be accepted and decline the offer. Some students will be offered a place on the WL and choose not to take it because they’re happy with another acceptance they have. @center is right in that WL spots may be offered as a “soft reject” to legacies or kids coming from schools/communities where the school would like to retain a positive relationship. (Future prospects are less likely to apply if they feel that nobody from their school ever gets into XYZ). But almost certainly, some of those kids on the WL will get in and it means that there are many kids on the WL who are qualified and will do fine at the school.
The WL is definitely a “real thing” and not a “joke”. Some years, schools will go to their WL even before the final response date and some will (as mentioned above) still be pulling kids as late as August because someone had a change of heart, got sick, or got into a preferred school at the last minute. There are years when schools and colleges accept very few from the WL and other years when it’s a sizeable number. Remember that when everyone shows up on move-in day, it doesn’t matter whether you were the one who was admitted a week ago or who was being courted by a coach since you were 11 – you’re all part of the same class.