Intent to sell is the key bit there. You can sell a gun you made yourself if you didn't make it with the intent to sell it.
In the context of gun buybacks, there is generally some promise of amnesty that prevents enforcement against these illegal gun manufacturers. If they were pulled over on their way to the gun buyback, they could probably be successfully prosecuted.