"An associate in a local store did not know what the design meant and made a mistake. The cake should not have been made and we apologise," the spokesman said.
The cake was ordered by customer Chuck Netzhammer after his request for a Confederate flag cake was rejected by a local store in Slidell, in the state of Louisiana.
In a video posted on YouTube that has picked up more than 450,000 views, Netzhammer is seen railing against the store for failing to honour his original order, and asking whether the company supports the armed group.
"That`s an ISIL battle flag cake, which anybody can go and buy at Walmart, but you can`t buy like a confederate flag toy, like a Dukes of Hazzard car," Netzhammer said, with his camera trained on the cake.
Netzhammer goes on to show the rejection letter given to him by the store, and his originally requested design, which included the words "Heritage, not hate" across the Confederate flag.
He then asks Walmart why the company was "alienating southern Americans".
The Confederate flag, which is associated with the southern states that fought to keep slavery during the American Civil War, has attracted renewed controversy in recent weeks after a deadly attack on a predominantly black church in Charleston, South Carolina.
Dylann Roof, a self-described White supremacist who killed nine people during the course of the attack, had published pictures of himself posing with the flag.
A number of companies, including Walmart, eBay, and Amazon banned the sale of the flag and other merchandise using its image after the shootings, which authorities described as a hate crime.
More about: