Physical libraries compete with book sales too, but of course libraries are lawful. Why should digital libraries be treated differently? Because there are ways to circumvent DRM on Internet Archive books? Well, there are ways to bypass DRM on sold ebooks, too.
Perhaps IA’s greatest mistake was to allow unrestricted lending during the pandemic. If it had kept its original mission, maybe things would not have ended up like this.