My friend is a criminal defense attorney for those who are usually unable to pay market rates. He's making a lot less than I was as a senior developer and not much more when I was a junior developer. Factor in law school loans and time spent in the books and he's not exactly rolling in cash.
Average salaries are skewed because the top-end is so high. If you have all the bona fides (top-tier law school/clerking opportunities, high-paying specialty, good track record of winning cases) you can command an astronomical hourly rate.
However, the vast majority of lawyers don't get those opportunities, and are working schlubs just like the rest of us.