Buying on margin is borrowing cash to open a new position. If the aggregate cash balance in a given account is a debit (negative balance), then funds are being borrowed and the loan is subject to interest charges. Note that even if the aggregate cash balance is a credit, a loan may still exist as a result of balance netting or timing differences.
For more information, please see How to determine if you are borrowing funds from IBKR in the IBKR Knowledge Base.