I am not a scholar, but I looked into this topic and came up with my own theory and conclusions. Perhaps you will find it though provoking.
———-
Allah has set this universe on a path and good or bad things happen either naturally or due to the person’s own actions using his free will or other peoples action using their free will. In both cases Allah will is there to let things happen as it may.
For example a truly pious person doesn’t take care of his finances and incurs financial loss .
Or a flood comes in and destroys both bad and good person’s crops.
The flood destroys bad person’s crops. The person then gets into severe mental anguish because he has no answer why, how and who caused it. The event either turn him toward good or the person continues toward bad and his life and afterlife, one or both turns worse and worse. The new path of life carved by the flood takes him to a worse position in the future.
On the other hand a pious person associates flood with Allah’s will and considers it a test and moves on. He keeps his mental peace and tranquility. Not only Allah adds rewards for the person for afterlife, the new path of life carved for the person by the flood takes the person to a more happier and tranquil life (not necessarily rich). And it is happiness, peace and tranquility is that everyone in this World is running after. It is only that people mistakenly think that they will find it in wealth, power or immorality.