SECTION 1. SHORT TITLE.

    This Act may be cited as the ``Solar Uniting Neighborhoods (SUN) 
Act of 2011''.

SEC. 2. CLARIFICATION WITH RESPECT TO LOCATION OF SOLAR ELECTRIC 
              PROPERTY.

    (a) In General.--Paragraph (2) of section 25D(d) of the Internal 
Revenue Code of 1986 is amended to read as follows:
            ``(2) Qualified solar electric property expenditure.--
                    ``(A) In general.--The term `qualified solar 
                electric property expenditure' means an expenditure for 
                property which uses solar energy to generate 
                electricity--
                            ``(i) for use in a dwelling unit located in 
                        the United States and used as a residence by 
                        the taxpayer, or
                            ``(ii) which enters the electrical grid at 
                        any point which is not more than 50 miles from 
                        the point at which such a dwelling unit used as 
                        a residence by the taxpayer is connected to 
                        such grid, but only if such property is not 
                        used in a trade or business of the taxpayer or 
                        in an activity with respect to which a 
                        deduction is allowed to the taxpayer under 
                        section 162 or paragraph (1) or (2) of section 
                        212.
                    ``(B) Recapture.--The Secretary may provide for the 
                recapture of the credit under this subsection with 
                respect to any property described in clause (ii) of 
                subparagraph (A) which ceases to satisfy the 
                requirements of such clause.''.
    (b) Limitation With Respect to Off-Site Solar Property.--Subsection 
(b) of section 25D of the Internal Revenue Code of 1986 is amended by 
adding at the end the following new paragraph:
            ``(3) Maximum credit for off-site solar property.--In the 
        case of any qualified solar electric property expenditure which 
        is such an expenditure by reason of clause (ii) of subsection 
        (d)(2)(A), the credit allowed under subsection (a) (determined 
        without regard to subsection (c)) for any taxable year with 
        respect to all such expenditures shall not exceed $50,000.''.
    (c) Effective Date.--The amendments made by this section shall 
apply to taxable years beginning after the date of the enactment of 
this Act.

SEC. 3. CLARIFICATION WITH RESPECT TO LOCATION OF SOLAR WATER HEATING 
              PROPERTY.

    (a) In General.--Section 25D(d)(1) of the Internal Revenue Code of 
1986 is amended--
            (1) by striking ``The term'' and inserting the following:
                    ``(A) In general.--The term'', and
            (2) by adding at the end the following new subparagraph:
                    ``(B) Off-site property.--
                            ``(i) In general.--Such term shall include 
                        an expenditure for property described in 
                        subparagraph (A) notwithstanding--
                                    ``(I) whether such property is 
                                located on the same site as the 
                                dwelling unit for which the energy 
                                generated from such property is used, 
                                and
                                    ``(II) whether the energy generated 
                                by such property displaces the energy 
                                used to heat the water load or space 
                                heating load for the dwelling, so long 
                                as any such displacement from such 
                                property occurs not more than 50 miles 
                                from such dwelling unit,
                        but only if such property is not used in a 
                        trade or business of the taxpayer or in an 
                        activity with respect to which a deduction is 
                        allowed to the taxpayer under section 162 or 
                        paragraph (1) or (2) of section 212.
                            ``(ii) Recapture.--The Secretary may 
                        provide for the recapture of the credit under 
                        this subsection with respect to any property 
                        described in clause (i) which ceases to satisfy 
                        the requirements of such clause.''.
    (b) Limitation With Respect to Off-Site Solar Property.--Paragraph 
(3) of section 25D(b) of the Internal Revenue Code of 1986, as added by 
section 2, is amended to read as follows:
            ``(3) Maximum credit for off-site solar property.--In the 
        case of--
                    ``(A) any qualified solar electric property 
                expenditure which is such an expenditure by reason of 
                clause (ii) of subsection (d)(2)(A), and
                    ``(B) any qualified solar water heating property 
                expenditure which is such an expenditure by reason of 
                subparagraph (B) of subsection (d)(1),
        the credit allowed under subsection (a) (determined without 
        regard to subsection (c)) for any taxable year with respect to 
        all such expenditures shall not exceed $50,000.''.
    (c) Effective Date.--The amendments made by this section shall 
apply to taxable years beginning after the date of the enactment of 
this Act.

SEC. 4. EXCLUSION OF INCOME FROM QUALIFYING SALES.

    (a) In General.--Part III of subchapter B of chapter 1 is amended 
by inserting before section 140 the following new section:

``SEC. 139F. INCOME FROM QUALIFYING SALES OF SOLAR ELECTRICITY.

    ``For any taxable year, gross income of any person shall not 
include any gain from the sale or exchange to the electrical grid 
during such taxable year of electricity which is generated by property 
with respect to which any qualified solar electric property 
expenditures are eligible to be taken into account under section 25D, 
but only to the extent such gain does not exceed the value of the 
electricity used at such residence during such taxable year.''.
    (b) Technical Amendment.--The Internal Revenue Code of 1986 is 
amended by redesignating the section added to such Code by section 
10108(f) of the Patient Protection and Affordable Care Act as section 
139E, and by locating such section immediately after section 139D of 
such Code (as added by section 9021(a) of such Act) and immediately 
before section 139F of such Code (as added by this section).
    (c) Clerical Amendment.--The table of sections for part III of 
subchapter B of chapter 1 of such Code is amended by striking all that 
follows after the item relating to section 139C and inserting the 
following items:

``Sec. 139D. Indian health care benefits.
``Sec. 139E. Free choice vouchers.
``Sec. 139F. Income from qualifying sales of solar electricity.
``Sec. 140. Cross references to other Acts.''.
    (d) Effective Date.--The amendments made by this section shall 
apply to taxable years beginning after the date of the enactment of 
this Act.
Solar Uniting Neighborhoods (SUN) Act of 2011 - Amends the Internal Revenue Code to: (1) expand the definitions of "qualified solar electric property expenditure" and "qualified solar water heating property expenditure" to allow a residential energy efficient property tax credit for solar energy property which is either installed in a taxpayer's residence or is located within 50 miles of such residence; and (2) exclude from gross income, for income tax purposes, gain from the sale or exchange of electricity generated by solar energy property eligible for such tax credit.
A bill to amend the Internal Revenue Code of 1986 to provide that solar energy property need not be located on the property with respect to which it is generating electricity in order to qualify for the residential energy efficient property credit.