There are two things going on here: there's general post-9/11 "port security", which may vary from place to place based on the port, and may preclude you from taking pictures on the gangplank, to/from the ship, or at any other place in and around the port that the port or DHS officials decide is off-limits. Dedicated cruise terminals tend to be more lenient about pictures outside of the ship of the dock areas than ports that also have commercial shipping.
Separate from that, there's the "customs hall" rule. This far predates 9/11, and includes the immigration, baggage claim, and customs check areas of international ports of entry (including land borders, cruise terminals, and airports). Photography has been prohibited in these areas for decades, and it's more or less a universal rule anywhere in the world. The US also enforces a "no cellphone" rule that prohibits talking, texting, or any other form of electronic communication while in the customs hall. And, unlike the private port security or even the TSA, the CBP officers in the customs hall are actual police officers, and they definitely have the authority to confiscate your equipment (or arrest you) if you don't comply.
I think why it's often an issue with cruises is that so many of them have little to no international travel experience, other than cruises. Just look at how many threads there are about people going on cruises without a passport - for the most part, these people have zero international travel experience. Anyone that has traveled internationally by air is likely to recognize the customs hall for what it is, and know about the "no photography" rule.