All of the class actions where I've gotten back $5 or whatever have a document listing how the money is spent. Usually at least a third of it goes to the lawyers.
Right, so in such a case, if the lawyers decided to work for free and give ALL the money to the class members, you'd get back a whopping $7.50 instead of $5.00.
Really, these cases are mostly a way for lawyers to make money, because on a person-by-person basis there's just not enough money to be made in pursuing legal action, but with millions of class members, the aggregate amount is pretty high, and 20 or 33% of that for the lawyers ends up being a nice paycheck.
The court awarded attorney fees of 20% of the overall (minimum) award in this case, which came to about $77 million. This is based off a $380.5 million minimum settlement fund (under certain conditions the fund can go up to $100-something million higher).