It's some Supreme Court interpretation of free speech plus legislation. I remember Al Franken talking about this a bit in the context of a law requiring disclosure that he supported but was not successful.
Looks like the dynamic hasn't changed much since he talked about it.
https://en.m.wikipedia.org/wiki/Citizens_United_v._FEC