It may depend on how he categorized it. Trump managed to write off his billion dollar loss on his Atlantic casinos, so there may be a way around that.
I don’t know the details of Trump’s casino write off but I would guess that it was a capital investment in a business enterprise that went bad, so he (through whatever vehicle(s) he used to make the investment) could write it off against capital gains. Could be several entities or pass through entities that made the investment, and thus could write it off.
Trump also bankrupted a few businesses. All legal. It happens. That’s capitalism.