Some of the CBP officers I have come across at US immigration have been polite and reasonable whilst others are clearly on some sort of power trip and need urgent customer services retraining. Those people are completely wrong for the organisation they serve and should not be employed by the CBP. What some of them seem to forget as well is that without passengers arriving into the airport, they would not have a job.
Their roles can be difficult and I know their working conditions are not ideal in terms of pay. I have seen many immigration officers over the decades I have travelled to the US and its always a mixed bag. For example he last immigration officer I saw was nice because he saw we share the same birthday. Another officer's initial comment towards us as a family was, "how much money have you got?").
It does not help passengers from their home country being the US or any other nation when they finally arrive into US airports to see there are only three members of staff available to process what can amount to several plane loads of passengers - and all individually (this happened at Houston). The whole process needs further streamlining, it is far too wasteful and inefficient for both airlines and passengers. And there is no will to change anything.
Not all passengers get directed to using the automated passport machines and these anyway are not always without problems. A lot of pax get rejected by these machines therefore obliging said passengers to line up further to see an immigration officer. It all makes for making a long day even longer.