Most of what you're describing is captured by the Kelly Criterion: it tells you the "optimal" fraction of your bankroll you should bet to maximize returns given the odds and EV. For a game with positive EV and 1 in 300M odds, you should be betting a
very small fraction of your overall bankroll -- well below $2 for anyone not already in the 0.01% wealth bracket. So indeed, it would be irrational (suboptimal) to participate in the lottery unless you were already very wealthy.
Even beyond the Kelly Criteria, you could also tweak your EV based on the marginal utility of a dollar -- i.e. going from $0 in savings to $10M would have a massive impact on your quality of life, whereas 10x'ing from there ($100M) would provide marginal additional benefit comparatively. Thus, (ignoring Kelly) the "quality of life EV" for a $10M jackpot with 1 in 5M odds is vastly better than a $100M jackpot with 1 in 50M odds despite having the same EV.
https://en.wikipedia.org/wiki/Kelly_criterion