The payment is the final resolution to a case brought by the New York attorney general's office after the Trump Foundation held a fundraiser for military veterans during the 2016 campaign.
The televised fundraiser took in nearly $3 million in donations that were dispersed on the eve of the Iowa caucuses as directed by then-campaign chief Corey Lewandowski.
The two million must be paid by President Trump himself for breaching his fiduciary duty to properly oversee the foundation that bears his name.
"I direct Mr. Trump to pay the $2,000,000, which would have gone to the Foundation if it were still in existence, on a pro rata basis to the Approved Recipients," Judge Saliann Scarpulla wrote.
The lawsuit filed by the state's attorney general accused President Trump -- along with his children, Donald Jr., Eric and Ivanka -- of conflating charity with politics, repeatedly using charitable donations for personal, political and business gains, including legal settlements, campaign contributions and even to purchase a portrait of Trump to hang at one of his hotels..
Filed in state Supreme Court by the attorney general's Charities Bureau, the suit sought to dissolve the private New York-based foundation and prevent the Trumps from serving as directors of any nonprofits in the future.
The foundation has already agreed to cease operations and must pay the two million to a consortium of nonprofit organizations.
Attorneys for Trump argued that the money was always used for charitable purposes within the law, such as in 2014 when Trump bid $10,000 of foundation money on a portrait of himself at a charity auction benefiting the Unicorn Foundation. Trump Organization attorney, Alan Futerfas told the court Trump only donated to start the bidding, but when no one else would bid, the Donald J. Trump Foundation was stuck with the painting.
When the lawsuit was filed in June 2018, President Trump attacked it and claimed the lawsuit was politically motivated.
"The sleazy New York Democrats, and their now disgraced (and run out of town) A.G. Eric Schneiderman, are doing everything they can to sue me on a foundation that took in $18,800,000 and gave out to charity more money than it took in, $19,200,000," the president said in a tweet referencing the former state attorney general.
The judge repeatedly rejected attempts by Trump to have the case dismissed.
After reviewing the record, Judge Scarpulla determined that "Mr. Trump breached his fiduciary duty to the Foundation and that waste occurred to the Foundation."
"Mr. Trump’s fiduciary duty breaches included allowing his campaign to orchestrate the Fundraiser, allowing his campaign, instead of the Foundation, to direct distribution of the Funds, and using the Fundraiser and distribution of the Funds to further Mr. Trump’s political campaign," Scarpulla wrote.
A spokesperson for the Trump Foundation, in a statement, said, "Since its inception in 1987, the Trump Foundation has distributed over $19 million to hundreds of worthwhile charities with little to no expenses. More than $9 million came directly from President Trump."
"Following the 2016 presidential election, the Trump Foundation publicly announced its intention to voluntarily dissolve and distribute all of its remaining funds to charity. Unfortunately, that donation was delayed due to the Attorney General’s politically motivated lawsuit," the statement continued. "We are pleased that the Court, in rejecting the Attorney General’s frivolous request for statutory penalties, interest and other damages, recognized that every penny ever raised by the Trump Foundation has gone to help those most in need."
ABC News' John Santucci contributed to this report.