By the ton means very greatly or extensively.
We ate tomatoes by the ton, i.e. we ate a huge amount of tomatoes. Or, the factory produced garbage by the ton.
Also used metaphorically. For example, of a poltician, he told lies by the ton. Or, he took bribes by the ton.