As Dandy Don mentioned, there's a difference in terms of going to and from Cozumel. US customs requires when you FIRST arrive in the US, you must present yourself and anything you're carrying for inspection. That's why you have to gather your bag and go through the process of walking past the immigration folks.
This is just the same as when you arrive in Cozumel, if it's your first arrival airport. You have to do the same thing. If for instance you first flew into Mexico City to connect to Cozumel (your first touchdown in Mexico) you'd do the same process as most of us do when we arrive in Cozumel. Then your ongoing flight to Coz would be a domestic flight and you'd not have to go through the whole process of immigration and customs like most of us do..
As also mentioned above, there are some agreements in place where you do your clearance (hence the "pre-clearance term) at your departure airport abroad and you land as a "US arrival" and don't have to do all the immigrations and customs process when you arrive. We do this when we fly in from Vancouver to the US. Our arrival is then at a "domestic" terminal.