Both companies are participating in the initial pilot launch with Wakefern Food Corp's ShopRite supermarket chain expected to join the program early next week, the USDA said. Walmart will offer the service in upstate New York, while ShopRite and Amazon will service the New York City area.

Food stamps are part of the Supplemental Nutrition Assistance Program, or SNAP, which provides free food to some 40 million Americans, or about 12 percent of the total U.S. population.

"People who receive SNAP benefits should have the opportunity to shop for food the same way more and more Americans shop for food – by ordering and paying for groceries online," U.S. Secretary of Agriculture Sonny Perdue said in a statement.

Walmart, the world's largest retailer, already has 40 stores in other parts of the country that allow shoppers to pay for groceries ordered online using food stamps.

The new program will expand to Alabama, Iowa, Maryland, Nebraska, New Jersey, Oregon and Washington, and additional retailers are expected to take part, the USDA said.

Walmart spokeswoman Molly Blakeman said the company has nearly 275 stores that offer grocery pickup in the nine states eligible for the pilot.

Amazon, the world's largest online retailer, in a blog post on Thursday said New York customers can shop on AmazonFresh and Prime Pantry without requiring a membership fee.

"Amazon believes the program will dramatically increase access to food for more remote customers and help to mitigate the public health crisis of food deserts," the retailer said.

The pilot program will involve the use of electronic benefit (EBT) cards issued by New York to allow for the online purchases.

(Reporting by Nandita Bose in Washington; Editing by Bill Berkrot)

By Nandita Bose