There is a clear difference between investing and gambling.
When you invest, you are purchasing an asset that has value. It is purchased in the hopes that the asset will either increase in value or generate income. This definition holds true whether you are investing in shares of stock, in real estate, or in a comic book collection. You can also purchase debt: if you loan money, you own debt that will (hopefully) be repaid and generate income.
Gambling is playing a game for chance. When you gamble, you have not purchased an asset; you have only paid to participate in a game. Some games have a degree of skill (blackjack, poker), others are pure chance (slot machine). In most gambling games, the odds are against the player and in favor of the one running the game.
Lottery tickets, without a doubt, are gambling.
There is a good article on Investopedia that discusses the difference between investing and gambling in more detail.
One thing that this article discusses is the house edge, or the advantage that the people running a gambling game have over the players. With most casino games, the house has an advantage of between 1 and 15% over the players. With a typical lottery, the house edge is 50%.
To address some of the points made by the OP's recent edit and in the comments:
I do not think the definitions of investment and gambling need to be dependent on expected value. There can be bad investments, where the odds of a good result are low. Similarly, there could be gambling games where the odds are in the player's favor, either due to the skill of the player or through some quirk of the game; it's still gambling.
Investing is purchasing an asset; gambling is a game of chance.
I do not consider a lottery ticket an asset. When you buy a lottery ticket, you are just paying a fee to participate in a game. It is the same as putting a coin in a slot machine. The fact that you are given a piece of paper and made to wait a few days for the result do not change this.
Assets have inherent value. They might be valuable because of their ability to generate income (stocks, bonds, debt), their utility (precious metals, commodities, real estate), or their desirability as a thing of beauty (collectibles), for example. A lottery ticket, however, is only an element of a game. It has no value other than in the game.