If law school is so expensive, it is harder to become a lawyer. If less people become lawyers, the supply decreases (resulting in the demand for the shortage of lawyers to be greater).
"There is no economic law that says that lawyers should make more money than programmers because they choose to be ripped off in pursuit of their training."
You don't NEED a degree to do programing. Arguably a computer science degree is standard but even then, you don't need 7 years of schooling. In order to be a lawyer, you need to complete law school.
At the end of the day, it's fair for a lawyer to charge more. Why? Because someone is willing to pay the premium.