The dollars do not come from consumers. They come from the owners of the companies involved.
And those owners hire management types who decide that it is more profitable to use the dollars for lawsuits, rather than pursuing other available alternatives.
If you are talking about this crap being a drain on the economy overall, I won't argue. Litigation is, IMO, a huge waste of resources compared with many alternatives. But the resources are not public resources, but instead, are privately owned. The companies involved can use their money any way they choose. That is the nature of capitalism.
Litigation is a path to larger overall profits. If other methods worked better, then, in theory, companies like Apple would use other methods to generate profits. But so long as they can sue their way to increased profits, Apple will use that weapon in preference to and in combination with other methods.
It is useful to question whether granting bullshit patents to Apple and then allowing Apple to foreclose obvious designs by other companies makes any sense. But that is a meta-question in the sphere of economic regulation, and should rightly be discussed in those terms. Many posters dislike these bullshit patents that Apple has been granted. May posters dislike the regulatory scheme which allows Apple to secure and to exploit such patents.
The money which consumers pay is to support the USPTO and the court system. Apple uses both of these public goods to gain higher private gains. But that is a drop in the bucket compared to the funds that Apple's owners pay to use litigation as a means to increase their profits.