That's the point the article makes, you are _not_ legally required to hand over the password.
> Officers routinely ask travellers to provide their passcode or password to devices so they can be examined, but they do not have the power to compel passengers to hand over their passcodes,
Right, and grandparent has a typo. True you are not required to hand over the password, but they aren't required to give you back your phone if you don't.
> There is no limit on how long the devices can be held but the agency said the policy was to keep devices for no longer than 14 days unless it took longer to examine them.
Right. So they don't give you back your phone. You may get it a couple of weeks later. Very convenient for your trip.
... and they're doing it for purely punitive reasons. We all know they're not "examining" the phones in any meaningful way. It's too expensive and failure-prone.