“Why leave direct trace evidence of a gun purchase?”
Because leaving the paper trail was the entire point. Why would he hand out Communist pamphlets in New Orleans right outside the club where the anti-Castro Cubans hung out? Because he was supposed to get arrested fighting anti-communists, to establish his bona fides as a communist.
Oswald’s activities in the years leading up to the assassination only really make sense when you realize someone was planning to use him for something which they wanted to blame on the communists, and they wanted to make sure there was a trail of evidence any reporter or investigator could find that would make him look guilty, and make him look like a communist.
This seems to be the case.