This happens because prices can change between the time you submit a transaction and the time it gets confirmed on the blockchain.
You try to swap 1 BNB for 100 CAKE tokens, but by the time the transaction confirms, the price moves and you only receive 98 CAKE.
That 2% difference is called slippage.
Slippage Tolerance in Bitiness
If the price changes beyond your set tolerance, the transaction will fail, and gas fees may still be charged.