If you aren't comfortable, they are underpaying you for the job they expect you to do. If you are comfortable, but leaving money on the table, you aren't getting all the value you produce.
You can call both of those being underpaid, but I would still argue that they are different. Most people need to be comfortable, while most people don't need to capture all the value they can. Staying at a company that pays you less can be perfectly reasonable.
The problem is of course that the market doesn't really guarantee being comfortable. A lot of people are being underpaid for being comfortable long term. But as I said leaving money on the table can be a problem in itself. If you do 90% of what produces value, but only get 50% of the value that isn't generally a good thing.
The danger of considering leaving money on the table as being underpaid is not seeing the value of things. Many people are saving money for some future event, not realizing what they are giving up, instead of integrating that thing into the present.
If you want to work on e.g. open source you don't save hundreds of thousands of dollars for the future. You get enough money that you can do it now. Whether that is having low living costs, extra vacation days, flexibility or room to risk changing jobs to open source companies. Otherwise chances are you just end up with a slightly bigger house.