The
current limits for campaign donations for individuals is $3,300 per candidate per election (so you can donate $3,300 during the primaries and another $3,300 for the general election).
Cohen paying Stormy Daniels far more than $3,300 in what was seen as a "donation" to the Trump campaign was found to be illegal -- and he served time in Federal Prison for doing it. But, yes, if the Trump campaign had given him the money up front that he used to pay Stormy Daniels, then the payment would have been completely legal. Trump paying him back, even if done with campaign money, after Cohen had got a loan and paid Stormy, does not make it legal. At least one analogy would be that if a friend is going to lose their house and I rob the bank to pay what is needed to prevent the house from being foreclosed (or even just writing a "rubber" check to delay the process), robbing the bank (or writing a fraudulent check) is still a crime, even if the friend pays back the money I stole.