Landlords can legally charge nonrefundable deposits so long as they designate the deposit as being nonrefundable. This may apply to an entire deposit or simply part of one.
It is perfectly legal for a landlord to charge deposits and fees before allowing a tenant to move into a unit. However, the part of the deposit set aside as "nonrefundable" should be designated in writing on either the lease agreement or in a separate document. If the landlord fails to include this document, he has a legal obligation to return all nonrefundable fees.
Nonrefundable fees often go toward expenses like cleaning after a tenant has vacated the premises. However, this should be agreed upon before the lease papers are signed and a landlord cannot charge more than one deposit for things like cleaning. However, if the unit requires more cleaning due to damage acquired by the tenant, he or she may require an additional deposit or keep more of the refundable deposit paid at the beginning of the lease.
Deposits in many states must be kept in a trust account and the tenant made aware of where the money is kept. If the landlord sells the property, check with the new landlord to make sure the deposit was transferred.