Donald Trump has, for years, served as president of a charitable foundation that, though named after himself, is not financed with contributions made out of his own pocket. Instead, contributions mostly seem to come from a range of Trump’s business partners, allowing him to parlay celebrity into securing credit for charity work.

And much of the foundation’s spending doesn’t really fit the traditional conception of philanthropy at all. Some of the money seems to flow back into Trump’s pockets through his businesses, while other funds are used to punish his political enemies or try to gain new friends in the conservative movement.

At times the level of self-dealing becomes downright comical. It spent $20,000 on a portrait of Donald Trump, for example, and $12,000 on buying Trump an autographed Tim Tebow helmet. When Trump's Mar-a-Lago club racked up $120,000 in fines from the town of Palm Beach, Florida for violating a local ordinance regarding the height of flagpoles, Trump eventually settled the dispute by agreeing to a $100,000 donation to a veterans' charity — and then had his foundation rather than the club pay the tab. The largest gift the foundation ever made was a $264,631 bequest that was used to renovate a fountain outside the windows of Trump’s Plaza Hotel. He’s also used the charity for some surprisingly small-time frauds.

Various aspects of this almost certainly violate the laws governing charities (he’s already been sanctioned by the state of New York), but several experts are also raising the question of whether Trump is guilty of criminal tax evasion. This is a difficult charge to prove, but the law requires the government to demonstrate knowledge and intent which means that scofflaws can often get off by pleading ignorance. But both Philip Hackney, a former IRS attorney now working as a professor of tax law, and Adam Chodorow, a tax law professor at Arizona State University, have written that the elements exist to at least begin an investigation.

Trump has likely broken a rule on directed income

There are at least two big non-criminal instances of wrongdoing at the Trump Foundation that reporting has uncovered. The first is that as the Huffington Post’s Christina Wilkie originally reported before the Washington Post’s David Fahrenthold added much more detail, it certainly looks like Trump was having people write checks to his foundation as a means of paying him for his work.

All told, Trump seems to have directed over $2 million in donations to his charity. That’s not illegal by any means, but “directed” donations of this sort are supposed to be reported to the IRS as personal income. Had Trump followed the precedent of the past 30-40 years worth of presidents and released his tax returns to the public, we could see if he followed the rule. He has not done so, and his campaign has been dodgy about answering reporters’ questions as to whether he reported income correctly.

“There’s been no intent, in any way, to go against any applicable rules, laws, and regulations,” Trump senior advisor Boris Epshteyn told Fahrenthold. Intent, as we shall see, is relevant to the possibility of a criminal charge. But it appears that Epshteyn is quietly admitting here that the income was not reported correctly.

The Trump Foundation was self-dealing

Just because you are the president of a foundation and it is named after you doesn’t make its resources your personal property. You cannot, for example, expend the money just to benefit yourself.

The Trump Foundation, for example, spent $100 on a couples’ membership to the Metropolitan Museum of Art. If the membership was for himself and his wife, that would be “self-dealing” which is against the rules. Trump’s campaign didn’t respond to Fahrenthold’s questions about who the membership was for. Other examples of self-dealing abound:

Melania Trump paid $20,000 at a charity auction for a portrait of Donald Trump. The Foundation cut the check, and the portrait reportedly landed at one of Trump’s golf courses.

Trump himself paid $12,000 at a charity auction for a football helmet autographed by Tim Tebow.

for a football helmet autographed by Tim Tebow. The Foundation also donated money to Florida Attorney General Pam Bondi, which was clearly illegal and resulted in a fine when it came to light. According to Fahrenthold, "Trump’s staffers said a series of errors resulted in the payment being made — and then hidden from the IRS."

There are also mixed cases, such as Trump giving Foundation money to the Palm Beach Police Foundation, which then in turn spent large sums of money on renting out the Trump-owned Mar-a-Lago resort for its annual gala.

This kind of self-dealing could (and probably should) get a non-profit organization shut down by the authorities. But it’s not necessarily a criminal matter.

A criminal case against Trump turns on knowledge

As Philip Hackney, an LSU professor who previously worked in the Office of the Chief Counsel at the IRS specifically focusing on tax exempt nonprofits, writes there are two possible legal charges against Trump:

Tax Evasion under section 7201 provides that “[a]ny person who willfully attempts in any manner to evade or defeat any tax imposed by this title or the payment thereof, shall” be guilty of a felony. The elements include (1) a tax deficiency that (2) the individual willfully failed to pay and (3) upon which the individual engaged in an affirmative act of evasion or attempted evasion. The government can prosecute a taxpayer on a separate count for each year there is an evasion or attempted evasion. False statements under section 7206 of the Code makes it a felony to willfully make and subscribe “any return, statement or document, which contains or is verified by a written declaration that it is made under the penalties of perjury, and which he does not believe to be true and correct as to every material matter.” The elements are (1) a signature on a return under penalties of perjury that (2) contains a materially false statement, that (3) the individual knew was false, and that (4) the individual willingly made.

Like many other white collar crimes that include a mens rea element, these are difficult cases to make. Trump’s self-dealing mainly consists of using the Foundation as a piggy bank any time he personally would like to cut a check to a non-profit organization for personal gain. This is not how the law works, and Trump likely owes the federal government money (plus additional penalties) for doing it. But to be criminally culpable, prosecutors would need to prove that he deliberately broke the law as opposed to simply being confused. The same is true of the directed donations which, to be perfectly honest with you, I thought was totally legal the first time I wrote about it.

I know our complex tax laws better than anyone who has ever run for president and am the only one who can fix them. #failing@nytimes — Donald J. Trump (@realDonaldTrump) October 2, 2016

Where Trump stands out from your average tax avoider, however, is that he claims to have an extraordinarily high level of US tax law.

At a rally in Pueblo Colorado, for example, he argued that he “brilliantly used” his understanding of the tax code to avoid personal income tax liability.

“I say we take him at his word,” Adam Chodorow of ASU Law School writes. “If I worked at the Internal Revenue Service, I would refer Trump to the Justice Department for a criminal investigation.”

An investigation might, at the end of the day, reveal no wrongdoing just as the various investigations into Hillary Clinton’s conduct over the years have all revealed no wrongdoing. But it would provide the opportunity to examine records, obtain sworn testimony, and otherwise shed more light on some clearly shady happenings at Trump’s foundation. Given what we know of Trump it’s certainly plausible that his claims to detailed knowledge of tax law are idle boasts and he was simply blundering. But while ignorance is a defense to tax evasion, a reputation for dishonesty is not.

Watch: Donald Trump hates lies, but can't tell the truth