This is a state by state question and usually a CCW has no bearing on the question. In some states, such as California, each firearm sale even between private individuals MUST go through a federally licensed firearms dealer. In Illinois the buyer must have a current FOID card.
In other states, such as Indiana, private sales just between two people are perfectly legal as long as the seller has no reason to believe the buyer is a prohibited from owning a firearm.
If you buy a firearm with the intent to sell or give it to a person you know is prohibited from owning a firearm you have committed a federal felony. If ANY person, prohibited or not, gives you money specifically to purchase a gun for them and you do just that, it is also a federal felony.
It is perfectly legal to purchase a firearm as a gift for someone such as a wife, a son, or a brother as long as they are not the ones giving you the money to make the purchase.