It's usually temporary, until Google tags the copycat site as a spammy content farm and destroys its ability to rank. I haven't seen a site sustain high ranking / lots of traffic through copying Stackoverflow in maybe a decade at this point (since Panda etc.).
It doesn't matter, though. It's a hydra. Different sites over time but the result is that google results on programming topics are reliably, and increasingly, shit. I gave up on it and pay for Kagi.
It doesn't need to sustain it, it just needs to be there when you search. I generally get SO first, but I see a LOT of copycats on the first page of DDG/Google when I search.
That's why I have Firefox bookmarks where I type `s <query>` into the address bar which enters `site:stackoverflow.com <query>` into my search engine. Likewise for `r <query>` => `site:reddit.com <query>`.
This annihilates the SEO spam and is useful for most of my searches. It's glorious finding recipe ingredients without wading through a blogger's life story or a search result page filled exclusively with ads above the fold.
I always thought it’s the opposite and platforms like SO and Medium incentivise posting there exactly via their crazy ___domain ranking.