Many exchange-traded funds that scored big on the meme-stock craze earlier this year are missing out on large gains this time around.

State Street’s SPDR S&P Retail ETF had roughly one-fifth of its assets in GameStop earlier this year, helping it score a 37% return in January. But by August, GameStop shares represented less than 1% of the fund’s assets. So when the stock took flight again last week, rising nearly 30%, the ETF gained just 2%.

The results underscore the swirling dynamics facing fund managers and others at a time of outsize gains in a handful of red-hot stocks. While some ETFs that invested in these firms last year have continued to reap gains, others have retreated from the shares in a bid to reduce risk and ended up missing out on fresh windfalls, potentially pressuring performance.

“A lot of people say we’re capping the upside, but we’re also mitigating the downside of a single stock that could blow up your investment thesis,” said Matt Bartolini, head of SPDR Americas Research at State Street Global Advisors

State Street’s retail ETF, which trades under the ticker symbol XRT, offers a way for investors to bet on a swath of the retail sector, usually giving roughly equal exposure to GameStop as to the industry juggernaut, Amazon.com Inc.

A big run-up in a particular stock, like with GameStop, over a brief stretch can dramatically reshape the $1.1 billion fund’s makeup. GameStop’s surge made it XRT’s biggest holding in late January and was the key contributor to the ETF’s best month ever. The position was so big, many traders on Reddit and other social-media sites began pitching the ETF as a way to play GameStop when some brokerages blocked users from trading shares.

GameStop’s big weight also made it a liability a month later: Shares of the videogame retailer fell nearly 70% in February, pulling XRT down 10%

When the ETF conducted its quarterly rebalance in March, XRT sold enough GameStop shares to bring the stock’s weighting in line with the other holdings. Immediately, the fund’s moves were more subdued even as GameStop shares continued to swing.

Performance also has been more muted. XRT shares are little changed this month even as GameStop’s are up 27%.

The ETF is “meant to provide exposure to the retail industry. One security shouldn’t dominate the returns,” said Mr. Bartolini. Maintaining broad exposure to all of the fund’s holdings is a goal for the ETF and part of why it isn’t weighted by market capitalization, he said.

A videogame ETF run by Wedbush and ETFMG also cut back on its hefty GameStop position. Shares of the Wedbush ETFMG Video Game Tech ETF, or GAMR, rose 36% in January. The videogame ETF sold GameStop stock in March and led the fund to impose a 15% ceiling on any one holding, said Ted Pollak, founder and president of GAMR’s index provider.

SHARE YOUR THOUGHTS

What does the future hold for GameStop and meme stocks? Join the conversation below.

Invesco’s $1.4 billion Dynamic Leisure and Entertainment ETF sold all of its AMC Entertainment Holdings shares on June 2 after the position ballooned to 18% of the fund’s assets from 2.7% in March. The reason: The movie-theater chain no longer met the index’s criteria for inclusion.

The decision has paid off for fundholders, the firm says. While the ETF is down 5% since the rebalancing, AMC shares have fallen about 15%.

“It’s a challenging situation for a person to sell on that particular day having seen the stock up more than six times,” said John Hoffman, Invesco’s head of ETFs and indexed strategies for the Americas. “ETFs take some of the emotion out of the process.”

The GameStop frenzy put the spotlight on a growing group of investors who seek and share trading information on social media platforms like YouTube and TikTok. Three investors explain how these online communities are helping them chase the market. Photo illustration: Adam Falk/The Wall Street Journal The Wall Street Journal Interactive Edition

Write to Michael Wursthorn at Michael.Wursthorn@wsj.com