It's the job of the TSA (or security guards at foreign airports) to search and clear you and your possessions for flying. They are preventing short-term threats, this is the last line of defense.
This story is about US Customs and Border Patrol, who are responsible for a lot of things at airports as well as border crossings, including:
1) Making sure you are permitted to enter the country (checking or issuing visas).
2) Making sure you are not bringing anything illegal into the country.
3) Making sure you are not a "threat" to the US. You're a criminal, or associated with activist/terroris organizations which are hostile to the US, or are likely to commit a crime during your stay.
Customs wasn't worried that this guy was going to blow up the next plane he got on. They were (stupidly) worried that he would (probably) cause trouble after he entered based on something somebody (might have) told them. So they played it safe and denied him entry.
The evidence they used was dumb, but at the border there is something between "we have evidence that you're a criminal and we're arresting you" and "you seem like trouble so we're not letting you be our guest".