Forget whether or not it's legal; it's mathematically stupid. The store owner gets no advantage by taxing you on each individual item vs. just taxing the bill as a whole because of the distributive property of multiplication.
A(x) + B(x) + C(x)
is exactly the same as
(A + B + C)x
You can try this on a calculator and you'll get the exact same answer each time.
The only possible benefit to the pizza place by doing it that way would be the cumulative effect of rounding. But even if they were being that shady, it only amounts to a few pennies per customer. Not exactly a profitable criminal enterprise.
More than likely what happened is the waitress didn't quite know how to ring you up so she made corrections to the ticket trying to fix something.