The word earn indicates receiving something in exchange for one’s work or commitment, i.e. a remuneration for an activity or service rendered.
The gain can be in money or some other form (an advantage obtained in exchange for a share, or the winning of a sum in a game).
In economics earning means profit or economic profit. Specifically, in trading problems the gain is the result of the positive difference obtained by subtracting the expense incurred from the revenues achieved, if the difference were negative we would instead have the loss.
In the exchange, the gain, as well as the losses, are linked to two types of returns: the dividend, which consists of the distribution of corporate profits at the end of the financial year, and the capital gain , which consists of the difference between the sale price and the purchase price of the shares.
For further information: "How to earn? 30 ideas to make more money"