Empty shopping cart at a Walmart entrance.

The U.S. Federal Trade Commission said on Tuesday it sued Walmart, alleging the company had allowed scam artists to use its money transfer services for fraud that cost consumers “hundreds of millions of dollars.”

Walmart, which offers some financial services, acts as an agent for money transfer services such as MoneyGram and Western Union.

For years, the FTC said, Walmart’s policy was to issue payouts even when fraud was suspected and that the retailer failed to take other actions to prevent consumers from being defrauded.

The result was the consumers were fleeced “out of hundreds of millions of dollars,” the agency said.

Walmart said in a statement that it would fight what it called a “factually flawed and legally baseless” lawsuit.

The FTC also said Walmart failed to properly train staff to help them prevent consumers from sending money to scammers.

The FTC said it was asking a court to order Walmart to return lost funds to consumers and to pay civil penalties.