Don't spread misinformation. The difference is that in Italy it is not against the law to not hand out the password to your phone -- or anything else for that matter.
In the United States, you have a fundamental right to not testify against yourself, including providing a password. You can be compelled to provide a biometric. The UK has taken a different approach and my understanding is that you can be jailed for refusing to provide a password.
Most countries recognize very different limits at a customs boundary. Is this appropriate in an age where a tiny device gives you access to all of your "papers" in many cases? I don't think so, but international law doesn't recognize our concerns with respect to that.
> Most countries recognize very different limits at a customs boundary.
In the US I've heard that boundary (the "border") encompasses ~75% of everyone living inside. It's like "within X miles of a border" and includes rivers and airports as well as the entire coastline.
I'm not up to date on these rules and who's been caught out by them, but I have repeatedly heard the claim above.
That is also true in the US. Of course they can use it as a reason to deny you access to the country if you’re a noncitizen, but you don’t have to hand it over.