The blockchain settles the transaction and records the finality.
Imagine a transaction as being a simple cryptographic signed message that sends 1 BTC to someone, you just broadcast it to the network and it gets recorded immediately. But if you expect to continue transacting with the same person, instead of broadcasting the transaction, you can hold on to it and keep iterating on top of it with new balances, each time signing the transaction so that your counterparty can always go to blockchain to claim their coins.
There's obviously some mechanism to avoid broadcasting old state and making sure you actually have the funds, etc, but you can't flood the network, even if you tried, you'd only be flooding your immediate neighbor which still charges fees, but much smaller fees than the blockchain. There's also mechanism for connecting those channels, so you don't need to have a direct channel with someone you want to pay, you just need a path to them.
Imagine a transaction as being a simple cryptographic signed message that sends 1 BTC to someone, you just broadcast it to the network and it gets recorded immediately. But if you expect to continue transacting with the same person, instead of broadcasting the transaction, you can hold on to it and keep iterating on top of it with new balances, each time signing the transaction so that your counterparty can always go to blockchain to claim their coins.
There's obviously some mechanism to avoid broadcasting old state and making sure you actually have the funds, etc, but you can't flood the network, even if you tried, you'd only be flooding your immediate neighbor which still charges fees, but much smaller fees than the blockchain. There's also mechanism for connecting those channels, so you don't need to have a direct channel with someone you want to pay, you just need a path to them.