If you take an AR pistol with, say, a 7.5" upper, remove that, and put a 16.5" buffer without changing the lower at all, then under federal law it's still a pistol. It's a pistol with a ridiculously long barrel, but still a pistol. Off the ATF website quoting federal code:
The term “Pistol” means a weapon originally designed, made, and intended to fire a projectile (bullet) from one or more barrels when held in one hand, and having:
- a chamber(s) as an integral part(s) of, or permanently aligned with, the bore(s);
- and a short stock designed to be gripped by one hand at an angle to and extending below the line of the bore(s).
Now, with a 16.5" barrel, you could then add a stock, and then it would be a non-NFA rifle (assuming that just about any lower would also meet the 26" overall length requirement as well). You could then remove the stock FIRST, and then use the short upper again - just make sure never to have the stock and short upper on at the same time without a too-much-fun-tax stamp.
Like yugorp said, just make sure it starts off as a pistol first and not originally a rifle!
Edit - state law, of course, might define a "pistol" by barrel length, but not federal law.