Among the shareholder class, there are a few different categories, each wins or loses a different amount due to the class-action:
1) Those who owned the stock at the time of the misrepresentation and continued to own it until the judgement/settlement. These people lose their portion of the lawyers' fees
2) Those who owned the stock at the time of the misrepresentation and sold it before the lawsuit ended. These people benefit from the judgement/settlement amount, minus lawyers' fees.
3) Those who did not own the stock a the time of the misrepresentation, but bought it before the end of the lawsuit. These people lose however much group 2 gained, in addition to some legal costs.
Out of the three groups, 1 and 2 are part of the class, but only 2 benefits from a successful complaint.
Yes, lawyers make a lot of money compared to individual shareholders. But in a class-action lawsuit, they make less overall money then they would if each shareholder had their own lawyer, and it costs the company far less to defend one shareholder class action then several thousand (and this is the entire point of class actions).