The difference is clear, investing what you can afford is used when you are interested in building future wealth while investing what you can afford to lose applies to cases where you just want a short-term profit and it mostly happens when you're trying things out.
I disagree. Even with long-term investing, it is good practice to only invest what you can afford to lose in the short term. Markets fluctuate, and even solid investments can experience temporary dips.
The concept of "afford to lose" depends on more than just income levels. For instance, an individual earning $200,000 annually may not actually have the flexibility to risk $40,000 if that would disrupt their overall financial security. The total financial picture matters - factors like existing debts and future needs should be weighed when deciding how much can reasonably be put at stake.
And I really wouldnt compare investing to gambling in any regard. They are fundamentally different financial activities with vastly different risk profiles and outcomes. Conflating the two does a disservice to the practice of thoughtful, research-based investing.