Their is desperation because when a gambler is at high loses he becomes very desperate and all his thinking faculty get blocked off because all what his mind will be telling him is to actually find a way to recover that funds even when he knows that he doesn't have nothing left to play somethings he can even sell his property at the spot or loan them because he is desperate and also too greedy to let go but on the greed aspect it's not too clear because only your emotions here and there can flip things for ya.
This is enhanced by the fact that the casino is like a machine which can both make money and lose money and is right in front of the gambler. So they get a false confidence that they can make the money back right from the casino if they play with more money. This increases the chances of their losses and stacks up more losses before they can recover and ultimately leads to a vicious cycle.
That is when all the borrowing money and all that comes in place. Which is another mistake waiting to be made.
The method to get out of this cycle is stop playing and find other ways to make the money back and pay off debts.