Again the courts disagreed.
And that's why it wasn't a legitimate expense
You mean the salary that he claimed to have declined?
No one was defrauded or had their rights harmed in any way by Trump paying the hush money and labeling it as legal expenses on his taxes.
Buying secrecy on personal activities is a valid legal expense.
{...
Key Facts
Trump’s indictment stems from the $130,000 payment, which Trump’s ex-attorney Michael Cohen made to Daniels in October 2016 to cover up her allegations of having an affair with Trump in 2006.
Trump then allegedly reimbursed Cohen $420,000—consisting of the Daniels payment, a separate expense, a $60,000 bonus and enough to cover taxes on the payment—which were made through the Trump Organization, though many came out of Trump’s personal bank account, and were allegedly falsely labeled as being for legal services through a retainer agreement.
The $130,000 Trump and Cohen paid to silence Daniels is not actually illegal in itself: “Hush money” agreements that both parties enter into consensually, in which one party pays money to stop the other party from revealing information, are actually perfectly legal in themselves, University of Pennsylvania law professor Tess Wilkinson-Ryan
told Slate.
Hush money payments can be illegal if they’re done to cover up a crime, or if it’s not a consensual agreement, such as in the case of blackmail or bribery, Wilkinson-Ryan noted.
In Trump’s case, he’s not being charged with making the payment itself or reimbursing it, but has only been indicted on 34 counts of falsifying business records, based on the fact that his reimbursement payments to Cohen were allegedly disguised as legal payments.
Even if hush money isn't inherently illegal, some prosecutors have argued the way Daniels was paid—through Cohen, right before the 2016 election—was a campaign finance crime: Cohen
pleaded guilty to federal campaign finance violations in 2018, after the Department of Justice alleged the Daniels payment was effectively a donation to Trump's campaign that exceeded the legal limit on political contributions.
...}
It clearly was not a political contribution by Cohen since he was reimbursed.
When you reimburse your lawyer, that is valid "legal payments".