This doesn't happen. While it may have at one time, it isn't so anymore. Security reasons being a chief reason.
Cruise lines do have special offers for unsold space but you have to book them beforehand and not at the pier. For example, Carnival has what they call 'Pack-and-Go' rates. But even with those there is at least a few days between the booking and the cruise. The the most recent sale had to be booked by May 18 and the earliest cruise that could be booked was for June 2.