In many cases this is perfectly legal, and many companies do just that (not directly with toothbrushes, but pay licence fees to offshore companies where taxes are low).
For another example, in slovenia, i can start a company, earn 100k (profit), and that profit gets taxed at 19% at the end of the year, and to take it out (pay it to me, the owner) aditional 25%. If I open the same company in bosnia, I can still to the same jobs with the bosnian company, but I only pay 10% on the money I take out (so, 100k->81k in slovenia, and to pay out, i get 60.75k... or i get 90k with a bosnian firm).
This is completely legal in slovenia in bosnia. Our "IRS" can't do anything about that.
So, first the laws have to change to make it fair, so facebook would pay taxes at the same rate a small local plumber would, and only than can IRS start their job.