BEIJING/SHANGHAI, Aug 9 (Reuters) - China's major state-owned banks were seen selling U.S. dollars to buy yuan in onshore spot foreign exchange market on Wednesday, three people with direct knowledge of the matter said, moves that would slow the pace of yuan declines.

The state banks usually act on behalf of China's central bank in the country's foreign exchange market, but they could also trade on their own behalf or execute their clients' orders.

The dollar selling comes as China reported disappointing inflation data, which showed consumer prices posted their first annual decline in more than two years in July, while factory gate prices extended their falls, as lacklustre demand weighed on the economy.

In addition, China's central bank set the yuan midpoint rate at a near one-month low, though not as weak as market forecasts - a sign investors interpreted as authorities' discomfort toward excess weakness in the local unit.

The onshore yuan traded at 7.2076 per dollar as of 0335 GMT, 123 pips, or 0.17%, firmer than the previous late night close of 7.2199. (Reporting by Beijing and Shanghai Newsroom; Editing by Himani Sarkar)