Complying with the terms of that traditional invitation does not require fine-grained legal knowledge; it is generally managed without incident by the Nation's Girl Scouts and trick-or-treaters.
A police officer not armed with a warrant may approach a home and knock, precisely because that is no more than any private citizen might do.