SECTION 1. SHORT TITLE.

    This Act may be cited as the ``Agricultural Energy Programs 
Reauthorization Act of 2017''.

SEC. 2. BIOBASED MARKETS PROGRAM.

    Section 9002 of the Farm Security and Rural Investment Act of 2002 
(7 U.S.C. 8102) is amended--
            (1) in subsection (b)--
                    (A) in paragraph (1), by inserting ``or renewable 
                chemicals'' after ``biobased products'';
                    (B) in paragraph (2)(B)--
                            (i) in clause (i), by inserting ``or 
                        renewable chemical'' after ``biobased''; and
                            (ii) in clause (ii), by inserting ``or 
                        renewable chemical'' after ``portions of 
                        biobased''; and
                    (C) by adding at the end the following:
            ``(5) Education and outreach.--The Secretary, in 
        consultation with the Administrator, shall provide to 
        appropriate stakeholders education and outreach relating to the 
        voluntary labeling program under this subsection.'';
            (2) in subsection (f), by striking the subsection 
        designation and all that follows through ``The Secretary'' and 
        inserting the following:
    ``(f) Manufacturers of Renewable Chemicals and Biobased Products.--
            ``(1) NAICS codes.--The Secretary and the Secretary of 
        Commerce shall jointly develop North American Industry 
        Classification System codes for--
                    ``(A) renewable chemicals manufacturers; and
                    ``(B) biobased products manufacturers.
            ``(2) National testing center registry.--The Secretary'';
            (3) in subsection (h)(2)--
                    (A) in subparagraph (B)(ii), by striking ``and'' at 
                the end;
                    (B) in subparagraph (C), by striking the period at 
                the end and inserting ``; and''; and
                    (C) by adding at the end the following:
                    ``(D) a description of the quantity of biobased 
                products procured under subsection (a) during the 
                previous year.'';
            (4) in subsection (i)--
                    (A) in paragraph (1), by striking ``$3,000,000 for 
                each of fiscal years 2014 through 2018'' and inserting 
                ``$6,000,000 for each of fiscal years 2019 through 
                2023''; and
                    (B) in paragraph (2), by striking ``2018'' and 
                inserting ``2023''; and
            (5) in subsection (j), by striking ``includes, with'' and 
        inserting the following: ``includes--
            ``(1) products produced from biologically captured and 
        reused carbon; and
            ``(2) with''.

SEC. 3. BIOREFINERY, RENEWABLE CHEMICAL, AND BIOBASED PRODUCT 
              MANUFACTURING ASSISTANCE.

    Section 9003 of the Farm Security and Rural Investment Act of 2002 
(7 U.S.C. 8103) is amended--
            (1) in subsection (b)(3)--
                    (A) in subparagraph (A), by striking ``and'' at the 
                end and inserting ``or''; and
                    (B) in subparagraph (B)--
                            (i) by inserting ``renewable chemical or 
                        biobased product'' before ``technology''; and
                            (ii) by striking ``biorefinery that 
                        produces an advanced biofuel.'' and inserting 
                        ``biorefinery.''; and
            (2) in subsection (g)--
                    (A) by striking paragraph (1) and inserting the 
                following:
            ``(1) Mandatory funding.--Of the funds of the Commodity 
        Credit Corporation, the Secretary shall use for the cost of 
        loan guarantees under this section, to remain available until 
        expended, $75,000,000 for each of fiscal years 2019 through 
        2023.''; and
                    (B) in paragraph (2), by striking ``2018'' and 
                inserting ``2023''.

SEC. 4. BIOENERGY PROGRAM FOR ADVANCED BIOFUELS.

    Section 9005(g) of the Farm Security and Rural Investment Act of 
2002 (7 U.S.C. 8105(g)) is amended--
            (1) in paragraph (1), by striking ``expended--'' and all 
        that follows through the period at the end and inserting 
        ``expended, $5,000,000 for each of fiscal years 2018 through 
        2023.''; and
            (2) in paragraph (2), by striking ``2018'' and inserting 
        ``2023''.

SEC. 5. RURAL ENERGY FOR AMERICA PROGRAM.

    (a) Definition of Renewable Energy System.--Section 9001(16) of the 
Farm Security and Rural Investment Act of 2002 (7 U.S.C. 8101(16)) is 
amended--
            (1) by redesignating subparagraph (B) as subparagraph (C); 
        and
            (2) in subparagraph (A), by striking ``that--'' and all 
        that follows through the period at the end of clause (ii) and 
        inserting the following: ``that produces usable energy from a 
        renewable energy source.
                    ``(B) Inclusions.--The term `renewable energy 
                system' includes--
                            ``(i) distribution components necessary to 
                        move energy produced by a renewable energy 
                        system to the initial point of sale; and
                            ``(ii) other components and ancillary 
                        infrastructure of a renewable energy system, 
                        such as a storage system.''.
    (b) Funding.--Section 9007(g) of the Farm Security and Rural 
Investment Act of 2002 (7 U.S.C. 8107(g)) is amended--
            (1) in paragraph (1), by striking ``expended--'' and all 
        that follows through the period at the end and inserting 
        ``expended, $150,000,000 for each of fiscal years 2018 through 
        2023.'';
            (2) in paragraph (3), by striking ``$20,000,000 for each of 
        fiscal years 2014 through 2018'' and inserting ``$50,000,000 
        for each of fiscal years 2018 through 2023''; and
            (3) by adding at the end the following:
            ``(4) Allocation of funding.--For each fiscal year, not 
        more than 30 percent of amounts made available to carry out 
        this section may be used for--
                    ``(A) any 1 form of renewable energy described in 
                subparagraphs (A) and (B) of section 9001(15); or
                    ``(B) technologies to improve the efficiency of 
                energy usage.''.

SEC. 6. BIOMASS RESEARCH AND DEVELOPMENT.

    Section 9008(h) of the Farm Security and Rural Investment Act of 
2002 (7 U.S.C. 8108(h)) is amended--
            (1) in paragraph (1), by striking ``expended--'' and all 
        that follows through the period at the end and inserting 
        ``expended, $20,000,000 for each of fiscal years 2019 through 
        2023.''; and
            (2) in paragraph (2), by striking ``2018'' and inserting 
        ``2023''.

SEC. 7. FEEDSTOCK FLEXIBILITY PROGRAM FOR BIOENERGY PRODUCERS.

    Section 9010(b) of the Farm Security and Rural Investment Act of 
2002 (7 U.S.C. 8110(b)) is amended--
            (1) in paragraph (1)(A), by striking ``2018'' and inserting 
        ``2023''; and
            (2) in paragraph (2)(A), by striking ``2018'' and inserting 
        ``2023''.

SEC. 8. BIOFUELS AND BIOBASED PRODUCT FEEDSTOCK AND WILDLAND FIRE 
              PROTECTION PROGRAM.

    Section 9011 of the Farm Security and Rural Investment Act of 2002 
(7 U.S.C. 8111) is amended--
            (1) by striking the section heading and inserting 
        ``biofuels and biobased product feedstock and wildland fire 
        protection program.'';
            (2) in subsection (a)--
                    (A) by striking paragraph (1);
                    (B) by redesignating paragraphs (2) and (3) through 
                (7) as paragraphs (7) and (1) through (5), 
                respectively, and moving the paragraphs so as to appear 
                in numerical order;
                    (C) in paragraph (1) (as so redesignated), by 
                striking ``BCAP'' and inserting ``program'';
                    (D) in paragraph (4) (as so redesignated)--
                            (i) in subparagraph (B)--
                                    (I) in clause (ii)(II), by striking 
                                ``and'' at the end;
                                    (II) in clause (iii), by striking 
                                the period at the end and inserting a 
                                semicolon; and
                                    (III) by adding at the end the 
                                following:
                            ``(iv) algae; and
                            ``(v) animal waste and byproducts, 
                        including fat, oil, grease, and manure.''; and
                            (ii) in subparagraph (C)--
                                    (I) by striking clauses (ii) and 
                                (iv); and
                                    (II) by redesignating clauses 
                                (iii), (v), (vi), and (vii) as clauses 
                                (ii), (iii), (iv), and (v), 
                                respectively;
                    (E) in paragraph (5) (as so redesignated), by 
                striking ``BCAP'';
                    (F) by inserting after paragraph (5) (as so 
                redesignated) the following:
            ``(6) Program.--The term `program' means the Biofuels and 
        Biobased Product Feedstock and Wildland Fire Protection Program 
        established under this section.''; and
                    (G) in paragraph (7) (as so redesignated)--
                            (i) by striking the paragraph heading and 
                        inserting ``Project area.--''; and
                            (ii) in the matter preceding subparagraph 
                        (A), by striking ``BCAP'';
            (3) in subsection (b)--
                    (A) in the matter preceding paragraph (1), by 
                striking ``Biomass Crop Assistance Program'' and 
                inserting ``Biofuels and Biobased Product Feedstock and 
                Wildland Fire Protection Program'';
                    (B) in paragraph (1), by striking ``BCAP''; and
                    (C) in paragraph (2), by inserting ``, including 
                eligible material harvested for the purpose of 
                hazardous woody fuel reduction'' before the period at 
                the end;
            (4) in subsection (c)--
                    (A) by striking the subsection heading and 
                inserting ``Project Areas.--'';
                    (B) by striking ``BCAP'' each place it appears;
                    (C) in paragraph (2)(B)--
                            (i) in the subparagraph heading, by 
                        striking ``BCAP project'' and inserting 
                        ``Project''; and
                            (ii) in clause (i) (as amended by 
                        subparagraph (B)), by inserting ``program'' 
                        before the semicolon at the end;
                    (D) in paragraph (4) (as amended by subparagraph 
                (B)), by inserting ``program'' before ``contract''; and
                    (E) in paragraph (5)(D) (as amended by subparagraph 
                (B)), by inserting ``program'' before ``payments on 
                land'';
            (5) in subsection (d)--
                    (A) in paragraph (1)(A), by striking ``BCAP'' and 
                inserting ``program'';
                    (B) in paragraph (2)(B), by striking ``paragraph 
                (3)'' and inserting ``paragraph (5)'';
                    (C) by redesignating paragraph (3) as paragraph 
                (5);
                    (D) by inserting after paragraph (2) the following:
            ``(3) Hazardous woody fuel reduction.--
                    ``(A) In general.--In accordance with regulations 
                issued by the Secretary to carry out this paragraph, 
                the Secretary may use amounts made available under 
                subsection (f)(1)(A) to provide to a project sponsor 
                that submits to the Secretary an application in 
                accordance with those regulations a payment under this 
                subsection for the transportation costs of a project 
                that removes eligible material for the purpose of 
                hazardous woody fuel reduction, as determined by the 
                Secretary.
                    ``(B) Considerations.--In determining which 
                projects to provide payments under subparagraph (A), 
                the Secretary shall consider--
                            ``(i) only projects that, as determined by 
                        the Secretary, in consultation with the Forest 
                        Service Fire Modeling Institute, are located in 
                        wildland areas that are the most--
                                    ``(I) at risk from wildfire; or
                                    ``(II) in need of restoration; and
                            ``(ii) which projects will provide--
                                    ``(I) the greatest benefit to the 
                                protection of human life and structures 
                                in the wildland-urban interface; and
                                    ``(II) the greatest protection of 
                                municipal water supplies.
            ``(4) Limitation on collection of biomass for environmental 
        benefit.--As a condition on the receipt of a payment under this 
        subsection, a producer or person described in subparagraph (A) 
        or (B) of paragraph (1), respectively, shall leave uncollected 
        and unharvested not less than 30 percent, as determined 
        appropriate by the Secretary, of the woody eligible 
        material.''; and
                    (E) in paragraph (5) (as redesignated by 
                subparagraph (C))--
                            (i) in the paragraph heading, by striking 
                        ``bcap'' and inserting ``program''; and
                            (ii) by striking ``BCAP'' and inserting 
                        ``program''; and
            (6) in subsection (f)--
                    (A) in paragraph (1), by striking ``Of the funds'' 
                and all that follows through the period at the end and 
                inserting the following:
                    ``(A) Mandatory funding.--Of the funds of the 
                Commodity Credit Corporation, the Secretary shall use 
                to carry out this section $70,000,000 for each of 
                fiscal years 2019 through 2023.
                    ``(B) Discretionary funding.--There is authorized 
                to be appropriated to the Secretary to carry out this 
                section $20,000,000 for each of fiscal years 2019 
                through 2023.''; and
                    (B) in paragraph (2), by striking ``the Secretary 
                shall use not less than 10 percent, nor more than 50 
                percent, of the amount'' and inserting the following: 
                ``the Secretary shall use--
                    ``(A) not less than $50,000,000 to make 
                transportation payments for hazardous woody fuel 
                reduction projects under subsection (d)(3); and
                    ``(B) not less than 10 percent, and not greater 
                than 50 percent, of the remaining amount''.

SEC. 9. COMMUNITY WOOD ENERGY PROGRAM.

    Section 9013(e) of the Farm Security and Rural Investment Act of 
2002 (7 U.S.C. 8113(e)) is amended by striking ``2018'' and inserting 
``2023''.

SEC. 10. EFFECTIVE DATE.

    The amendments made by this Act take effect on October 1, 2018.
Agricultural Energy Programs Reauthorization Act of 2017  This bill amends the Farm Security Rural Investment Act of 2002 to reauthorize through FY2023 several Department of Agriculture (USDA) energy programs, including:   the Biobased Markets Program;  the Biorefinery, Renewable Chemical, and Biobased Product Manufacturing Assistance Program;   the Bioenergy Program for Advanced Biofuels;  the Rural Energy For America Program (REAP);  the Biomass Research and Development Initiative;  the Feedstock Flexibility Program; and  the Community Wood Energy Program.   The bill modifies and reauthorizes the Biomass Crop Assistance Program to:  rename it the Biofuels and Biobased Product Feedstock and Wildland Fire Protection Program;  require USDA to provide assistance under the program for hazardous woody fuel reduction projects; and  expand the definition of eligible materials to include algae and animal waste byproducts, including fat, oil, grease, and manure.   The bill provides mandatory funding through FY2023 for several of the reauthorized programs.  The bill modifies the Biobased Markets Program to: (1) include producers of renewable chemicals in the voluntary labeling program, and (2) require USDA and the Department of Commerce to jointly develop North American Industry Classification system codes for renewable chemical manufacturers and biobased products manufacturers. The bill modifies REAP to prohibit more than 30% of the funds from being used each year for: (1) any one form of renewable energy, or (2) technologies to improve the efficiency of energy usage. 
Agricultural Energy Programs Reauthorization Act of 2017