Investors in mainland China turned into buyers of Hong Kong stocks in June, defying weakness on the broader market as they bought on dips by artificial-intelligence plays including Semiconductor Manufacturing International Corp (SMIC) and Knowledge Atlas Technology.Onshore investors bought a combined HK$27.1 billion (US$3.5 billion) of the city’s stocks via the cross-border Stock Connect programme last month, reversing an outflow of HK$3.6 billion in May, according to the data from the Hong Kong stock exchange. While AI stocks absorbed net inflows, Alibaba Group Holding and other Chinese internet platforms, which are seen as proxies for consumer spending, bore the brunt of sell-offs, the data showed.The mainland buying failed to counter the weight on Hong Kong stocks in June, as the Hang Seng Index slumped 9.1 per cent for the biggest monthly decline in more than two years. A lack of AI hardware companies and a shift by the Federal Reserve to a more hawkish tone drove a rotation out of the city’s stocks and into the markets in South Korea and Taiwan, the centre of the AI trade in Asia.“Hong Kong stocks are facing a double whammy of fund outflows and higher borrowing costs overseas, which suppresses valuations,” said Xu Chi, an analyst at Zhongtai Securities. “But stock valuations are already at depressed levels. Hong Kong stocks may have a catch-up on gains if expectations about a Fed cut resurface or the global AI trade spills over.”In the first six months, mainland investors put HK$305.5 billion into Hong Kong stocks, a decrease of about 60 per cent from a year earlier, according to bourse data.Among all the Hong Kong-listed companies available via the southbound investment channel of the Stock Connect scheme, Kingboard Holdings was the prime beneficiary, with HK$20 billion of net buying by mainland investors in June, according to data provider Wind Information.