A landlord can charge you to paint if the painting is needed because of damage done by the tenant.
However for routine painting of the apartment, home etc the landlord cannot charge the tenant for routine painting.
Much like routine carpet cleaning, if a tenant did something that caused the landlord to be forced to paint (smoking is a common example), then it is likely legal that the landlord charge the tenant to paint.
Or for example if you as the tenant painted the interior of the place you're renting and did not restore it back to the original paint color when you left then the landlord can charge the tenant for the painting of the place you rented.
They would most likely just take the cost out of your renters security deposit.
Also landlords cannot charge you for simple wear and tear such as carpets needing replaced after so many years, flooring needed replaced etc.
But if you damaged the flooring or carpet etc then the landlord can charge you for repairs.