The payment could have been made legally, but there are numerous steps including disclosures that didn't happen, so it is very black and white that it was a campaign law violation. That's why Cohen is a crappy lawyer and going to jail.
That also assumes that a nondisclosure agreement is automatically a campaign contribution....which is yet another stretch. Nope; this is another nothing burger.