It works if the ! is quoted, as in the example.
If enabled, history expansion will be performed
unless an ! appearing in double quotes is escaped
using a backslash. Only backslash (\) and single quotes can quote the history expansion character.
where the newer man page says: Only backslash (\) and single quotes can quote the history expansion character,
but the history expansion character is also treated as quoted if it
immediately precedes the closing double quote in a double-quoted string.
Thanks for pointing this out!