Many foreign logistics companies that expanded into China have had a tough time competing against local players. While some are retreating, private-equity companies eager to be part of the country’s e-commerce and consumption boom are investing in logistics businesses ranging from warehousing to refrigerated food transportation.

Last week, Carlyle Group said it was collaborating with real-estate investment manager Townsend Group, as well as warehouse developer and operator Shanghai Yupei Group, to invest a total of $400 million in 17 warehouses in China that will be leased to firms including retailers and e-commerce companies. That came just days after a domestic consortium that included Citic Capital Holdings Ltd., the private-equity arm of state-owned Citic Group, and state-owned China Merchants Group bought an up to 25% stake in Chinese courier S.F. Express (Group) Co. for an undisclosed amount.

The backers of S.F. Express are betting on big growth ahead. Consultancy A.T. Kearney estimates that S.F., founded two decades ago, already has about 20% of the domestic express-delivery market. That puts it on par with EMS China, the express-delivery business of state-controlled China Post, and well ahead of international players like FedEx Corp. and United Parcel Service Inc.

“Successful Chinese logistics firms have strong supply-chain management…so it makes sense for private-equity firms to back the local players,” said Hina Group Managing Director Brian Qiao. Hina’s private-equity arm invested in Hangzhou-based logistics firm Best Logistics Technology in 2011.

China’s e-commerce boom, Beijing’s plan to switch to a consumption-led economy and the expansion of manufacturing inland are boosting demand for logistics services.

In June, Hengyang Petrochemical Logistics Ltd. received 271.25 million yuan ($44.3 million) from Macquarie Everbright Greater China Infrastructure Fund. The logistics firm, which provides storage and transportation facilities for liquid petrochemicals, plans to expand its operations along the Yangtze River.

Despite the euphoria, foreign express-delivery firms, which often operate at higher costs and face regulatory restrictions, are struggling to compete against their Chinese peers, and in some cases are discontinuing services in the country.

“Foreign airfreight companies can’t operate planes domestically in China, meaning that foreign logistics providers have to lease Chinese airfreight companies’ planes to provide airfreight services,” said Jian Li, principal at A.T. Kearney. The government also bars foreign firms from delivering documents and letters within China, a business that yields higher profit margins than delivering packages, he added.

Express delivery is one of the fastest growing areas within logistics in China, expanding around 30% annually, analysts said.

In March, Dutch parcel-delivery giant TNT Express NV said it would sell Hoau, its domestic road distribution unit, to Citic Private Equity, after buying it in 2007. A TNT spokeswoman said this week the sale was in line with the firm’s interests to focus on Europe, and that TNT would continue to develop its international delivery services to and from China.

In 2011, German logistics giant DHL Express scaled back its delivery services in China, when the firm’s Chinese joint venture sold its stake in domestic courier Sinotrans A-Plus Express. The domestic business, which had accumulated losses of around 99 million yuan by the end of 2010, faced competition from low-cost Chinese rivals and suffered from the 2009 ruling that restricted foreign companies to package delivery.

A DHL spokeswoman said the firm still delivers domestically within China to a small number of customers, but is focusing on its international express operations.

To be sure, not all foreign logistics companies are suffering in China. Singapore-based Global Logistics Properties Ltd. is the market leader in China’s logistics real-estate business, which includes warehousing facilities, with a market share of more than 40%, according to A.T. Kearney.

Unlike developed economies, China lacks modern logistics facilities.

“As strong growth in domestic consumption and exponential expansion of e-commerce continue to bolster demand for modern logistics facilities, Carlyle sees good opportunities to invest in the logistics warehouse sector,” said Jason Lee, managing director and head of Carlyle Asia Real Estate.

Cathay Capital Private Equity founder Mingpo Cai said China needs delivery businesses that can provide better services in a market where players are often competing on price alone. “It isn’t about a three-wheeler delivering seafood wrapped up in a quilt anymore,” he said.

In August, Cathay and the Sino-French fund it manages invested $19.6 million in Shanghai Zhengming Modern Logistics Co., which operates refrigerated trucks in China that transport food for businesses including McDonald’s Corp., China Mengniu Dairy Co. and Haagen-Dazs.