We are talking about a port of entry into the US. Did the immigrations officer ask these questions, or the customs officer?
In truth, I don't think they should be challenging US citizens either who are trying to enter, but they do have the responsibility to try to keep US citizens from bringing illegal stuff into the US (not just Cuban cigars, but kiddie porn and other things of that nature as well). If it is after immigrations and the customs guy was grilling me, I'd tell him to look in my bags if he wanted, but that I didn't feel it appropriate to answer his questions.
I'd like to see a zero question mentality exist for all country borders, similar to Schengen, but I guess the CBP officers get bored and feel like either making conversation or trying to 'trip someone up'.