Say you had a non-retirement account with a few different stocks. Some did well, others lost money.
If you sold $6k of your worst performing stocks, then funded an IRA account for the year with $6k of income you made in that year, and rebought those in the tax advantaged account, you would create losses outside of the retirement account to help offset any gains. And you would be able to keep your positions (assuming that you want to keep those stocks).
Are there any legal concerns with this strategy?