The First Amendment guarantees (1) the free exercise religion, and (2) the right of free speech. In its limited political involvement on moral issues, the Church acts within the protection of the First Amendment.
Under Section 501 (c) (3) of the Internal Revenue Code, tax-exempt organizations such at The Church of Jesus Christ of Latter-day Saints are allowed to be involved in political issues and maintain their tax exemption as long as (1) their involvement is not a substantial part of their total activities, and (2) they do not participate or intervene in political campaigns on behalf of or in oppositions to any candidate for public office.
The Church clearly meets the requirements for tax-exempt organizations. Its involvement with political issues is rare and does not involve a significant fraction of its total activities and assets when one considers the substantial resources committed by the church to missionary work, temple and meeting house building and maintenance, family history, education, etc. Further, the Church maintains strict neutrality regarding political candidates.
This should lay to rest any assertions that the Church's efforts in support of traditional marriage are in violation of the IRS Tax Code.