The best way to avoid this sort of trouble seems to be "be a large enough company that your internal operations make it too confusing to work out who to prosecute".
But as illustrated in Breaking Bad season 5 (the Madrigal situation for those who have watched it), things don't necessarily work out going that way either.