47 U.S. Code § 230 - Protection for private blocking and screening of offensive material
https://www.law.cornell.edu/uscode/text/47/230
They were given immunity to allow a greater range of viewpoints without being held accountable for those that might be considered offensive or dangerous.
The companies nearing monopoly status are taking advantage of this to skew the views that are allowed to be expressed via censoring those they don't like.