Same way Social Security works - with the exception of federal taxes and criminal judgements, SS payments are largely exempt from garnishment or other actions to seize assets to repay debts. You can't lose your UBI by taking a loan and gambling the proceeds away, because the debtor cannot force you to use UBI to repay the loan.