I've been to Key West on many cruises and never had to go through Immigration prior to leaving the ship, most usually this stop has been after Cozumel. I do recall seeing a Customs & Border Protection team aboard the Century one time, after we left Cozumel, so that may have had something to do with it on that particular cruise. Also, with on-line check in and it's containing our passport information it is possible that is sufficing as an Immigration check for U.S. citizens for some U.S. ports.
As Dwayne said, different rules apply for different nationalities and can be based on the itinerary. On the Mariner Of The Seas we stopped as Nassau as port #1 and our next stop was St. Thomas. Everyone aboard had to go through Immigration on the ship. Americans went to one lounge and did a quick passby waiving our credentials, those from other countries went to a different lounge to be checked.