A nonprofit social welfare organization, known as a 501(c)(4) group after the relevant section of the tax code, can engage in limited political activity, so long as this is not its primary work. Via an affiliated Political Action Committee, it can lobby elected officials and endorse or oppose candidates.
Organizations with 501(c)(4) status are exempt from federal income taxes, but donations made to them are not tax deductible.
Charitable, religious, and educational organizations can obtain 501(c)(3) status. Donations to these organizations are tax-deductible, but their political engagement is limited to nonpartisan activities.