They have opt-in consent: it’s a known part of the US ham licensing process that the database is public and searchable, and nobody is forced to get a ham license.
In fact, several of the questions on the ham test involve the fact that you can look up operator info online.