This is what the law requires:
https://www.brocardi.it/testo-unico-immigrazione/titolo-ii/capo-i/art6.html
The relevant paragraph is no. 3 in the link.
“Lo straniero che, a richiesta degli ufficiali e agenti di pubblica sicurezza, non ottempera, senza giustificato motivo, all'ordine di esibizione del passaporto o di altro documento di identificazione e del permesso di soggiorno o di altro documento attestante la regolare presenza nel territorio dello Stato è punito con l'arresto fino ad un ann o e con l'ammenda fino ad euro 2.000.”
The Emglish translation is below
“Any foreigner who, at the request of public security officials and agents, fails, without justifiable reason, to comply with the order to produce his or her passport or other identification document, residence permit, or other document certifying his or her regular presence in the territory of the State is punishable by imprisonment of up to one year and a fine of up to €2,000.”
I emphasized the phrase “without justifiable reason”. Unfortunately the statute does not specify what constitutes “justifiable reason”, therefore we must rely on the legal doctrine and jurisprudential precedents.
The document below, explains in very technical language such circumstances.
https://www.dippol.it/wp-content/uploads/2020/06/I-motivi-che-giustificano-lomessa-esibizione-di-documenti-da-parte-dello-straniero.pdf
You can read the entire document in case you have trouble sleeping, but relevant passage is the one below, translated by your truly:
“Such justified reason may apply, in the case of theft of documents, or entry into Italy following a shipwreck, or loss of documents as a result of war or other public disasters, or when the person detained has never possessed them or is a foreign minor, or when the foreigner is temporarily without them and its identification is not, in any case, hindered.”
I have emphasized the last sentence. So, my conclusion is that if you happen to be momentarily without your passport (including because you left them at the hotel) make sure that you facilitate as much as possible your identification by the officer. That means having photocopies of your passport, your hotel information, and any possible government ID (including your US driver’s license). No guarantee that you may not be still taken to the police station, but chances are that, if you are an American or Canadian, the most serious consequence will be just a stern lecturing warning by the officer. The law mentions 2000€ in fine AND one year imprisonment, not either or. And I can guarantee you that no Italian officer will go to the trouble of arresting a North American tourist for having left their passport in the hotel room. The Italian court system doesn’t have resources for much more heinous crimes, let alone this.
For sure know that you should not leave town, on a day trip, without your passport, especially because those kind of checks are most common at or near train stations. That is where undocumented aliens tend to congregate and that is where the police focuses its attention.