Yes, this is why you need to think in terms of fee
rate... not total fee
amount... I'll use a somewhat extreme example to illustrate:
TransactionA: 50,000 byte transaction that pays 1 sat/byte = 50,000 sats to the miner in fees
TransactionB: 226 byte transaction that pays 100 sat/byte = 22,600 sats to the miner in fees
Now, you might think, well obviously take the 50,000 sats! But theoretically, you could fit
another 220 of the smaller transactions in the same "space" in your block... and then you would get: 221 * 22600 = 4,994,600 sats!!?!
So,
when you have a lot of transactions to choose from, it is (generally) the fee
rate that makes the difference as to whether or not a transaction will be prioritised.
Obviously, if you don't have many transactions to choose from, the fee rate becomes less of an issue, which is why when there are not a lot of unconfirmed transactions and they can all fit, the miners will just include everything to get as much fee value as they can!