Helaman also directs his sons to be righteous for the right reasons. While Helaman does not evoke the same imagery as Jesus does during the Sermon on the Mount, the intent is the same. These namesakes are to be righteous for the sake of God, not to “boast.”
Reference: This verse echoes language from the Sermon on the Mount. Evidently the meaning—doing righteousness for the right reason—triggered Joseph Smith’s selection of Matthew 6:1–4, 19–21, including the specific reference to treasure in heaven (v. 20):
Take heed that ye do not your alms before men, to be seen of them: otherwise ye have no reward of your Father which is in heaven.
Therefore when thou doest thine alms, do not sound a trumpet before thee, as the hypocrites do in the synagogues and in the streets, that they may have glory of men. Verily I say unto you, They have their reward.
But when thou doest alms, let not thy left hand know what thy right hand doeth:
That thine alms may be in secret: and thy Father which seeth in secret himself shall reward thee openly.…
Lay not up for yourselves treasures upon earth, where moth and rust doth corrupt, and where thieves break through and steal:
But lay up for yourselves treasures in heaven, where neither moth nor rust doth corrupt, and where thieves do not break through nor steal:
For where your treasure is, there will your heart be also. (Matthew 6:1–4, 19–21)