An entry refusal, even for something as black-and-white as an improper visa, can take 2-4 hours of processing/paperwork by customs and immigration. Then the passenger needs to be held, fed, and cared for medically in a secure facility (not all airports have one onsite), and finally a return flight needs to be arranged. It could be days before one is available. This is very costly and can be avoided by a gate agent doing a two minute cursory check. 
 
	 
 
	And there is a central database called Timatic which all airlines use for determining entry eligibility (e.g. what visa do Indians need to enter Panama). But as we found out, there are edge cases and nuances which are not 100% obvious, as happened in our case. CBP also has a hotline which airlines can use 24/7 to resolve any potential issues before a passenger boards.