You also can't charge an agent fee for merely giving someone access to a database, and you can't be both the agent and the landlord, nor the agent and the previous tenant.
Unfortunately, the difficult housing market ended up creating all sorts of other bribes. The most common is the previous tenant selling their furniture for an exhorbitant fee, or straight up requesting a bribe. These are obviously illegal, and you would be entitled to keep the apartment even after getting your money back in court. However rights are of little importance if you don't have the time/energy/means to enforce them. It's also a bad way to start a relationship with a landlord.
German law is firmly on the side of tenants, but sometimes the greed is just too strong, and there is an endless supply of applicants who are willing to compromise.
More info here: https://allaboutberlin.com/guides/housing-scams#scams-by-lan...