Imam Ali (AS) said:
Whenever you are greeted, reciprocate in a better way; and whenever a hand helped you, make it up with a better help/good deed. However, the advantage is with the one who starts the kind act [1]. Imam Ali (AS) explained that politeness manages the society. When we have been told to greet (say Salaam) each other; it is because when a society wants to live in safety, respect, and friendship, needs to protect politeness, and whatever protects the society is this mutual politeness. Imam Ali (AS) said: If someone greets you (says Salaam to you), it is Wajib to greet back in a similar manner or better [2].
[1] Nahjul Balaghah, Sobhi Salih, Wisdom 62.
[2] Explanation by the Grand Ayatollah Javadi Amoli, Qom, (09/02/2019).
Source: en.shafaqna.com