A man who was once the highest-ranking uniformed officer in the NYPD avoided charges in a corruption scandal that rocked the department — even though his bank records revealed some $300,000 in transactions that the FBI called the hallmarks of “money laundering,” The Post has learned.

The feds’ investigation turned up surveillance photos that show former Chief of Department Philip Banks making some of the deposits, while other photos show “at least one other person, whom the FBI has not been able to identify, making deposits into these accounts,” according to a sworn affidavit filed in Manhattan federal court.

“The investigation has not uncovered any legitimate source for this income in BANKS’s or his spouse’s accounts, which far exceeds both his NYPD salary and the rental income he received from properties he owns, and which also far exceeds his spouse’s salary as a nurse,” FBI Special Agent Joseph Downs wrote in the filed affidavit.

Downs’ affidavit was part of an application for a cellphone wiretap that was approved on Oct. 30, 2014 — one day before Banks stunned the city by abruptly rejecting a promotion to first deputy commissioner and instead announcing his retirement from the NYPD.

At the time, Banks said he quit because the new job “would take me away from where I could make the greatest contribution: the police work and operations that I love so much.”

The mystery transactions involved “numerous accounts” controlled by Banks and his wife, Vonda Smith, and were made between 2007 and 2013, according to the affidavit.

During that time, Banks served as executive officer of Patrol Borough Brooklyn South, commander of Patrol Borough Manhattan North and chief of community affairs before his 2013 promotion to chief.

Banks’ annual salary in that post was $201,096, payroll records show.

His cash deposits and withdrawals were often made in “small increments,” according to the affidavit, which cites seven deposits, ranging from $520 to $1,200 each, that Banks made on four dates between Aug. 26 and Nov. 3, 2013.

Someone else also deposited $1,540 and $60, respectively, into two of Banks’ accounts on Sept. 8, 2013, the affidavit says.

The “volume and pattern” of the banking activity, along with other evidence, “is indicative of the Subject Offense of money laundering,” Downs wrote.

“Specifically, based on my training and experience, and participation in this investigation, I know that individuals who wish to conceal the illegal sources of financial proceeds often make efforts to conceal those proceeds by engaging in financial transactions with banks or by having third parties engage in such transactions that hide the true source of the proceeds of unlawful activity,” he said.

Downs’ affidavit was one of at least five that were submitted to judges as part of a sprawling investigation into what turned out to be a $12 million Ponzi scheme run by former Harlem restaurant owner Hamlet Peralta, who last year pleaded guilty to wire fraud and is serving a five-year prison sentence.

The affidavits don’t detail when the feds began investigating Banks, but a Jan. 10, 2015, filing reveals that the Manhattan US Attorney’s Office asked the IRS to join the probe in August 2014, citing the “unexplained cash deposits into the accounts of Banks and his wife.”

The IRS agreed the following December, Downs wrote, noting that tax investigators found Banks owned three properties in Queens: his family home and two others that “appeared to the IRS to be single-family residences that may have been subdivided for use as rental properties.”

Banking records showed that between 2007 and 2013, Banks’ tenants gave him money orders and checks for more than $245,000 in rent — none of which he reported to the IRS, the affidavit says.

The feds said that rental income was separate from the mysterious deposits.

“BANKS also did not report as income the hundreds of thousands of dollars in unexplained cash deposits reflected on the bank records, as described in the Prior Applications,” Downs wrote.

In addition, during “certain tax years between 2007 and 2012,” Banks and his wife apparently reduced their tax bills by not filing their returns as “married filing jointly or married filing separately,” the affidavit says.

“Instead, they each filed separately as ‘head of household,’ and BANKS’s wife falsely listed her address as the address of one of the properties that BANKS in fact rented out to other tenants, where BANKS’s wife did not in fact live,” Downs wrote.

At some point, Banks allegedly invested $250,000 with Jona Rechnitz, a former fundraiser for Mayor Bill de Blasio who later pleaded guilty to a corruption charge as part of a cooperation deal with the feds.

And on Dec. 16, 2014, the affidavit says, IRS agents served a subpoena on Banks’ tax preparer, sparking a flurry of calls and text messages between Banks and Rechnitz.

The following Feb. 6, Banks was caught on wiretap allegedly telling Rechnitz that he had been informed he wouldn’t likely face tax charges because “everything is really in [Banks’] wife’s name” and that the punishment was “just going to be a penalty.”

Rechnitz — who last year testified that he lost about $500,000 in Peralta’s Ponzi scheme, of which only $150,000 was his own money — was later caught on a March, 6, 2015, wiretap telling his dad, Los Angeles developer Robert Rechnitz, that he gave Banks’ money back, along with a “nice return” of 5 percent interest, according to an affidavit filed the following month.

Downs wrote that the FBI believed Rechnitz repaid Banks — with interest — even though he hadn’t been paid by Peralta because he was worried about IRS scrutiny of Banks.

The US Attorney’s Office declined to say why it didn’t bring charges against Banks.

But a senior law enforcement official who was briefed on the investigation said, “It certainly looked to me, based on the descriptions, that they had a structuring case” — which involves depositing small amounts of cash to avoid detection — and “potential money laundering and tax evasion.”

But the official said prosecutors “did not feel they had anything that could stick in court and convict Banks.”

“At the end of the day, they felt that it’s very easy to get an indictment but you have to prove it in court,” the official said.

Banks, 55, seemed stunned when The Post confronted him at his home Sunday afternoon with the allegations contained in the affidavits. He began shaking and his eyes welled up with tears before he said, “No, I have no comment.”

Banks also said his wife had no comment and referred The Post to his lawyer, Benjamin Brafman, who said the tax case was “resolved with no prosecution.”

Brafman also said the money at issue came from an inheritance, rent payments and “poker games,” but declined to answer other questions.

Additional reporting by Shawn Cohen and Kevin Sheehan