A trust line on the XRP Ledger has a limit. Why can you exceed it after buying?
If you receive a token from an issuer on the XRP Ledger, the trust line records the balance and settings between you and that issuer. The limit you set can restrict how much of that token others can cause you to hold through payments. It’s easy to mistake this setting for a holding limit on your entire wallet, but placing an order yourself follows a different set of rules.
The XRP Ledger order book documentation explicitly states that a trust line limit does not restrict Offer execution. For example, you may be close to a token’s trust line limit when someone pays you directly; the payment is still subject to the receiving limit. If you place a buy order yourself and it is executed, however, your balance can exceed that limit. The difference is that a payment is initiated by someone else, while a buy order is a trade you have explicitly chosen to make.