Are there any laws in Germany preventing this type of sketchy behavior?
Yes, very much so. A booking is a contract between the hotel and you. Unless the contract or terms of service explicitly state a right to cancellation for any of the parties, both are bound to uphold their end or are liable to pay damages to the opposing party.
Even if it is stated in the terms of service, it might still not give them the right to back out of the contract. Certain points of the terms of service can be null and void if they penalize one party unilaterally. I'm no lawyer but I think cancelling 3 days before the trip without reason falls in this category.
Also, the only reason that the hotel can claim otherwise is if they could not forsee the unavailability of those rooms, like the hotel burnt down or something like that.
In all other cases, dissovling the contract can only be done in agreement of both parties - which is what they might have tried to do here. If they try this with enough people, some might just say okay, and they have dissolved the contract.
Considering the comments, I'd guess they were trying to pull one on you and got caught pants down...