How does the tax law distinguish a security deposit from advance rent

Subject: Business    / Accounting
Question

How does the tax law distinguish a security deposit from advance rent?

Explain how security deposits are accounted for both landlord and tenant.

When is a security deposit “transformed” into:

1. rent deduction for the tenant?

2. rent income to the landlord?