That was because the "appropriation" of the soup cans did not cause Campbell's any harm. It was credited with helping sales. If he had been sued he likely would have lost.
Warhol was sued by others for infringement and settled the suits.
That's fine. It varies enough from the original that it doesn't infringe.