He tried to enter on the US Visa Waiver program. If the guard doesn't like you then you don't get in.
Getting a visa in advance does make the guard do more paperwork if they refuse entry.
From some US gov website; --- To use the program, visitors must waive all rights of review or appeal of decisions made by an immigration officer and all rights to contest action in deportation except for asylum.