Dear Friend of Brooklyn Tenant:
No it is not legal to steal. Your friend could have gone to Housing Court that day to obtain a court order for access only to remove his property from the room after the lock was changed. If the lock was changed during an eviction conducted by a NYC Marshal executing a warrant of eviction issued by the court, then the actual act of eviction may be legal. if the landlord on its own changed the lock and the eviction was not made by the City Marshal, then your friend is also entitled to a court order to be restored to possession of the room.
When you know the identity of the thief the police find it easier to investigate a complaint.
New York does not have a specific law about storing property after an eviction. But since your friend could have gone to court the same day, the issue is the theft and not the breach of duty owed by the landlord to the tenant by not securely storing his property for any set or imagined or customary length of time.
Maybe your friend could prove the value of the lost property in Small Claims Court. Again, if the landlord alone without the City Marshal changed the lock the eviction may be illegal. Police should deal with a reported crime. If the tenant were legally evicted, then left his property behind and did nothing to try to get access to the property either by direct demand to the landlord or by gaining a court order for access and more than a reasonable amount of time passed from the eviction until discovery of the actual lose ( say thirty days in the case of an SRO) your friend may have a hard time proving entitlement to damage.
The answer provided to you is in the nature of general information. The general proposition being that you should try to avoid a bad outcome if you can.