I did a little reading, but got bogged down in the legalese. I couldn't quite make out why attack ads are 'okay' under this ruling, and supporting ads are limited.
The short version is that there is a specific kind of organization, a 501 c 4, that must be chartered and operated for the improvement of the "public good". They get tax exempt status, and, more recently, are exempted from needing to disclose their sources of revenue. The justification of this (which I find a little meh) would be that it would allow "whistle blowers" to get a message out for the public good without fear of repercussions.
This means that if you just run attack ads meant to "enlighten the public" about how a certain politician or political party or proposed measure is the work of the devil, that's fine, but if you advocate for a specific candidate, you're clearly operating for the benefit of an individual rather than the public which doesn't qualify for the tax-exempt/non-disclosure status.
Companies that know that they can pour donations into a crepe-paper "organization" dedicated to making attack ads to torpedo candidates and measures that are pro-worker or pro-regulation without worrying about the public knowing about their leanings, without worrying about potential boycotts and the like, are apparently happy to do so.
The conservatives have gone really really berzerk with this practice this election, but in fairness, the liberals did it first (and got in trouble, and stopped).