Exhibit 10.4
================================================================================

                             STOCKHOLDERS AGREEMENT

                                     BETWEEN

                              BIOFUEL ENERGY CORP.

                                       AND

                        CARGILL BIOFUELS INVESTMENTS, LLC

                              DATED: June 19, 2007

================================================================================

                                TABLE OF CONTENTS

                                                                            Page
                                                                            ----

                                    ARTICLE I

                                   Definitions

SECTION 1.01. Definitions......................................................1
SECTION 1.02. Other Defined Terms..............................................3
SECTION 1.03. Rules of Construction............................................3

                                   ARTICLE II

                              Transfer Restrictions

SECTION 2.01. Prohibited Parties...............................................3
SECTION 2.02. Termination Procedures...........................................4
SECTION 2.03. Cargill Confidential Information.................................4

                                   ARTICLE III

                         Business Expansion Restrictions

SECTION 3.01. Change in Project Scope..........................................4

                                   ARTICLE IV

                                  Miscellaneous

SECTION 4.01. Notices..........................................................5
SECTION 4.02. Successors and Assigns; Third-Party Beneficiaries................6
SECTION 4.03. Amendment and Waiver.............................................6
SECTION 4.04. Counterparts.....................................................6
SECTION 4.05. Specific Performance.............................................7
SECTION 4.06. Headings.........................................................7
SECTION 4.07. Severability.....................................................7
SECTION 4.08. Entire Agreement.................................................7
SECTION 4.09. Term of Agreement................................................7
SECTION 4.10. Further Assurances...............................................7
SECTION 4.11. Governing Law....................................................7
SECTION 4.12. Other Rights.....................................................7
SECTION 4.13. Consent to Jurisdiction; No Jury Trial...........................7

                                      - i -

                        This STOCKHOLDERS AGREEMENT, dated as of June 19, 2007,
                  is between BioFuel Energy Corp., a Delaware corporation (the
                  "Company"), and Cargill Biofuels Investments, LLC, a Delaware
                  limited liability company. Unless otherwise provided in this
                  Agreement, capitalized terms used herein shall have the
                  respective meanings given to them in Section 1.01.

            WHEREAS, the parties hereto wish to set forth certain understandings
regarding the relationship between the Company and Cargill (as defined below);
and

            WHEREAS, the parties hereto wish to provide for, among other things,
restrictions on the acquisition of Voting Securities by a Prohibited Party (each
as defined below).

            NOW, THEREFORE, in consideration of the mutual covenants and
agreements set forth herein and for good and valuable consideration, the receipt
and adequacy of which are hereby acknowledged, the parties hereto agree as
follows:

                                    ARTICLE I

                                   Definitions

            SECTION 1.01. Definitions. As used in this Agreement, and unless the
context requires a different meaning, the following terms have the meanings
indicated:

            "affiliate" of any Person means another Person that directly or
indirectly, through one or more intermediaries, controls, is controlled by, or
is under common control with, such first Person; provided that for purposes of
this Agreement, neither the Company nor any of its Subsidiaries shall be deemed
an affiliate of Cargill. For the purposes of this definition, "control" when
used with respect to any Person, means the possession, directly or indirectly,
of the power to direct or cause the direction of the management and policies of
a Person, whether through the ownership of voting securities, by contract, or
otherwise; and the terms "controlling" and "controlled" have meanings
correlative to the foregoing.

            "Agreement" means this Agreement as the same may be amended,
supplemented or modified in accordance with the terms hereof.

            "BioFuel Production" means the business of developing, constructing,
owning and operating ethanol or biodiesel production and processing plants,
engaging in commercial sales of ethanol, biodiesel and byproducts, and engaging
in the mixing, transportation and storage of ethanol, biodiesel and byproducts,
in each case.

            "Board of Directors" means the Board of Directors of the Company.

            "Business Day" means any day other than Saturday, Sunday and any day
that is a legal holiday in New York, New York or a day on which banking
institutions in New York, New York are authorized by law or other governmental
action to close.

                                                                               2

            "Business Expansion" means an expansion of the Company's business
beyond BioFuel Production.

            "Business Expansion Response Period" has the meaning set forth in
Section 3.01(a).

            "Cargill" means Cargill Biofuels Investments, LLC, a Delaware
limited liability company, and any of its affiliates, so long as such affiliate
is also a controlled affiliate of Cargill, Incorporated, a Delaware corporation.

            "Cargill Arrangements" means the arrangements among Cargill Parent
or one or more of its controlled affiliates, on the one hand, and the Company or
one or more of its Subsidiaries, on the other hand, pertaining to (i) grain
elevator leases, (ii) corn supply, (iii) ethanol marketing, (iv) distilled dried
grains marketing, (v) corn risk management, (vi) energy risk management and
(vii) natural gas supply, to the extent any such arrangements are in place from
time to time.

            "Cargill Parent" means Cargill, Incorporated, a Delaware
corporation.

            "Certificate" means the certificate of incorporation, as may be
amended from time to time, of the Company.

            "Class B Stock" has the meaning set forth in the LLC Agreement.

            "Common Stock" means the shares of common stock of the Company, par
value $0.01 per share.

            "knowledge", as it relates to the Company or Cargill, means with
respect to any matter in question, that any officer of the Company or Cargill
has actual knowledge of such matter after reasonable inquiry and investigation.

            "LLC Agreement" means the Second Amended and Restated Limited
Liability Company Agreement of BioFuel Energy, LLC, a Delaware limited liability
company, dated June 19, 2007.

            "Members" has the meaning set forth in the LLC Agreement.

            "Person" means any individual, corporation, partnership, limited
liability company, joint venture, association, joint-stock company, trust,
unincorporated organization, government or any agency or political subdivision
thereof or any other entity.

            "Prohibited Party" means any one of the Persons listed on Schedule A
attached hereto, which may be updated by Cargill on an annual basis, and
affiliates of such Persons; provided that in no event may there be more than
five (5) Prohibited Parties at any time (excepting affiliates of such Prohibited
Parties).

            "Subsidiary" means, with respect to any Person, any corporation,
limited liability company, partnership, association or business entity of which
(i) if a corporation,

                                                                               3

a majority of the total voting power of shares of stock entitled (without regard
to the occurrence of any contingency) to vote in the election of directors,
managers or trustees thereof is at the time owned or controlled, directly or
indirectly, by that Person or one or more of the other Subsidiaries of that
Person or a combination thereof or (ii) if a limited liability company,
partnership, association or other business entity (other than a corporation), a
majority of partnership or other similar ownership interest thereof is at the
time owned or controlled, directly or indirectly, by any Person or one or more
Subsidiaries of that Person or a combination thereof. For purposes hereof, a
Person or Persons shall be deemed to have a majority ownership interest in a
limited liability company, partnership, association or other business entity
(other than a corporation) if such Person or Persons shall be allocated a
majority of limited liability company, partnership, association or other
business entity gains or losses or shall be or control any managing director or
general partner of such limited liability company, partnership, association or
other business entity. For purposes hereof, references to a "Subsidiary" of any
Person shall be given effect only at such times that such Person has one or more
Subsidiaries.

            "Units" has the meaning set forth in the LLC Agreement.

            "Voting Securities" means the number of securities of the Company
that is determined by adding together (a) the number of outstanding shares of
Common Stock and (b) the number of outstanding shares of Class B Stock.

            SECTION 1.02. Other Defined Terms. The following capitalized terms
are defined in this Agreement in the Section indicated below:

      Defined Term                                           Section
      ------------                                           -------
      Company                                                Preamble
      Control Event                                          2.01(a)
      Termination Notice                                     2.02

            SECTION 1.03. Rules of Construction. Unless the context otherwise
requires, references to sections or subsections refer to sections or subsections
of this Agreement. Whenever required by context, the singular form of nouns,
pronouns and verbs shall include the plural and vice versa.

                                   ARTICLE II

                              Transfer Restrictions

            SECTION 2.01. Prohibited Parties. (a) Cargill Parent or any of its
controlled affiliates, as party to any of the Cargill Arrangements, shall have
the right, but not the obligation, to terminate, in its sole discretion, any or
all of the Cargill Arrangements in accordance with the procedures set forth in
Section 2.02 if a Prohibited Party obtains control of the Company (a "Control
Event"). The Company shall cause

                                                                               4

any of its controlled affiliates that are affected by any such termination not
to object to such termination. For purposes of the definition of "Control
Event", "control" shall mean either (i) the direct or indirect ownership of more
than thirty percent (30%) of the Voting Securities or (ii) the power to elect a
majority of the Board of Directors.

            (b) If a Control Event occurs, then, no later than 10 calendar days
following the date on which the Company learns or reasonably should have learned
of such Control Event, the Company must provide written notice to Cargill;
provided, however, that any failure by the Company to provide written notice to
Cargill of a Control Event does not diminish or derogate in any way the
termination rights regarding the Cargill Arrangements as contemplated by this
Section 2.01.

            SECTION 2.02. Termination Procedures. Any termination of the Cargill
Arrangements pursuant to Section 2.01 must be communicated by Cargill Parent or
one of the controlled affiliates of Cargill Parent, as an applicable party to
the Cargill Arrangement, by providing written notice to the Company (a
"Termination Notice") no later than 60 calendar days following the Company's
written notice to Cargill of a Control Event pursuant to Section 2.01(b). Any
such termination will be effective no earlier than 120 days following the date
of the Termination Notice; provided that the Company will use its reasonable
best efforts to cause the termination to be effective (by finding a replacement
for Cargill Parent or the applicable affiliate of Cargill Parent), as promptly
as possible.

            SECTION 2.03. Cargill Confidential Information. If Cargill obtains
knowledge of a Control Event (whether by receiving a written notice from the
Company pursuant to Section 2.01(b) or otherwise) then any of Cargill, Cargill
Parent or their respective affiliates may take whatever reasonable steps that
they deem appropriate or necessary to limit, manage, restrict or otherwise
control the disclosure to, and use by, the Company and its affiliates of any
confidential or proprietary information previously disclosed or that would
otherwise be disclosed by Cargill, Cargill Parent or their respective affiliates
pursuant to any Cargill Arrangements, unless and until such time as Cargill
Parent or all of the applicable affiliates of Cargill Parent have provided
written notice to the Company of their decision not to terminate any of the
Cargill Arrangements in connection with a Control Event, or, in the case where
Cargill gives notice of termination, the effective date of such termination;
provided that, until the effectiveness of any termination or expiration of the
Cargill Arrangements, Cargill Parent or its controlled affiliates, as an
applicable party to the Cargill Arrangements, shall use reasonable efforts to
minimize disruption to, and interference with, the Company's operations or the
performance of their respective obligations under the contracts governing the
Cargill Arrangements.

                                   ARTICLE III

                         Business Expansion Restrictions

            SECTION 3.01. Change in Project Scope. (a) Prior to effecting a
Business Expansion, the Company must obtain the approval of Cargill. Before
seeking Cargill's approval, the Company shall consult with Cargill regarding the
nature of the

                                                                               5

proposed Business Expansion and shall provide Cargill with details, projections,
business plans and any related materials as may be reasonably requested by
Cargill. Once the Company has provided Cargill with all reasonably requested
materials as contemplated by this Section 3.01(a), the Company shall provide
Cargill with a written request to effect the Business Expansion. No later than
45 calendar days following the Company's written request (the "Business
Expansion Response Period"), Cargill shall respond in writing to the Company
indicating whether Cargill grants its consent to the Company's request to effect
a Business Expansion. If Cargill does not consent or fails to respond within the
Business Expansion Response Period, then the Company and Cargill shall follow
the procedures described in Section 3.01(b).

            (b) If Cargill has not consented or has failed to respond to the
Company's request pursuant to Section 3.01(a) to effect a Business Expansion
prior to the end of the Business Expansion Response Period, then the Company
may, in its sole discretion, provide Cargill with a written notice, no later
than 30 calendar days following Cargill's written notice denying Cargill's
consent to the Business Expansion or the end of the Business Expansion Response
Period, advising Cargill that either (i) the Company has abandoned the proposed
Business Expansion or (ii)(A) Cargill must exchange the Units then owned by
Cargill for shares of Common Stock in accordance with Section 8.03 of the LLC
Agreement and (B) Cargill must sell the Common Stock then owned by Cargill (and
received in exchange for Units either as a result of the exchange described in
clause (ii)(A) above or as a result of an earlier exchange of Units) to the
Company or to one or more Members or other Persons reasonably acceptable to
Cargill (but not any Prohibited Party) designated by the Company, at a price
equal to the amount of Cargill's capital contributions (whether in cash or
in-kind) attributable to such shares of Common Stock. Any such sale must be
completed no later than 60 calendar days after the Company's notice to Cargill
and the consideration for such purchase must be in cash. Following completion of
the Company's purchase right as contemplated by this Section 3.01(b), the
Company will no longer be restricted with respect to any Business Expansion.

                                   ARTICLE IV

                                  Miscellaneous

            SECTION 4.01. Notices. All notices, demands or other communications
provided for or permitted hereunder shall be made in writing and shall be by
registered or certified first-class mail, return receipt requested, telecopier,
courier service or personal delivery:

            (a) if to the Company:

                  BioFuel Energy Corp.
                  1801 Broadway, Suite 1060
                  Denver, CO 80202
                  Telephone: (303) 592-8110
                  Attention: Scott H. Pearce

                                                                               6

            (b) if to Cargill:

                  Cargill Biofuels Investments, LLC
                  c/o Cargill, Incorporated
                  15407 McGinty Road West
                  Wayzata, MN  55391-2399
                  Attention: Ethanol Strategic Account Leader / MS 62

            All such notices, demands and other communications shall be deemed
to have been duly given: (i) when delivered by hand, if personally delivered;
(ii) when delivered by courier, if delivered by commercial courier service;
(iii) five (5) Business Days after being deposited in the mail, postage prepaid,
if mailed; and (iv) when receipt is mechanically acknowledged, if telecopied.
Any party may by notice given in accordance with this Section 4.01 designate
another address or Person for receipts of notices hereunder.

            SECTION 4.02. Successors and Assigns; Third-Party Beneficiaries.
This Agreement shall inure to the benefit of and be binding upon successors and
permitted assigns of the parties hereto. This Agreement is not assignable,
except in connection with a transfer of Units or Common Stock in accordance with
the LLC Agreement or the Certificate by Cargill to a controlled affiliate of
Cargill Parent. No Person other than the parties hereto and their successors and
permitted assigns is intended to be a beneficiary of this Agreement.

            SECTION 4.03. Amendment and Waiver. (a) No failure or delay on the
part of any party hereto in exercising any right, power or remedy hereunder
shall operate as a waiver thereof, nor shall any single or partial exercise of
any such right, power or remedy preclude any other or further exercise thereof
or the exercise of any other right, power or remedy. The remedies provided for
herein are cumulative and are not exclusive of any remedies that may be
available to the parties hereto at law, in equity or otherwise.

            (b) Except as otherwise provided herein, any amendment, supplement
or modification of or to any provision of this Agreement shall be effective only
if it is made or given in writing and signed by each of the Company and Cargill.
Any waiver of any provision of this Agreement and any consent to any departure
by any party from the terms of any provision of this Agreement shall be
effective only if it is in writing and signed by the party waiving its right or
consenting to such departure. Any such amendment, supplement, modification,
waiver or consent shall be binding upon the Company and Cargill.

            SECTION 4.04. Counterparts. This Agreement may be executed in any
number of counterparts, each of which when so executed shall be deemed to be an
original and all of which taken together shall constitute one and the same
agreement. Any counterpart or other signature hereupon delivered by facsimile
shall be deemed for all purposes as constituting good and valid execution and
delivery of this Agreement by such party.

                                                                               7

            SECTION 4.05. Specific Performance. The parties hereto intend that
each of the parties have the right to seek damages or specific performance in
the event that any other party hereto fails to perform such party's obligations
hereunder. Therefore, if any party shall institute any action or proceeding to
enforce the provisions hereof, any party against whom such action or proceeding
is brought hereby waives any claim or defense therein that the plaintiff party
has an adequate remedy at law.

            SECTION 4.06. Headings. The headings in this Agreement are for
convenience of reference only and shall not limit or otherwise affect the
meaning hereof.

            SECTION 4.07. Severability. If any one or more of the provisions
contained herein, or the application thereof in any circumstance, is held
invalid, illegal or unenforceable in any respect for any reason, the validity,
legality and enforceability of any such provision in every other respect and of
the remaining provisions hereof shall not be in any way impaired, unless the
provisions held invalid, illegal or unenforceable shall substantially impair the
benefits of the remaining provisions hereof.

            SECTION 4.08. Entire Agreement. This Agreement is intended by the
parties as a final expression of their agreement and intended to be a complete
and exclusive statement of the agreement and understanding of the parties hereto
in respect of the subject matter contained herein. There are no restrictions,
promises, representations, warranties or undertakings, other than those set
forth or referred to herein. This Agreement supersedes all prior agreements and
understandings among the parties with respect to such subject matter.

            SECTION 4.09. Term of Agreement. This Agreement shall become
effective upon the execution hereof and shall terminate (i) when (a) Cargill
ceases to hold any Common Stock or Units and (b) none of Cargill Parent or any
of its controlled affiliates is a provider to the Company of any of the services
contemplated by the Cargill Arrangements or (ii) upon the written agreement of
each of the parties hereto.

            SECTION 4.10. Further Assurances. Each of the parties shall, and
shall cause their respective affiliates to, execute such documents and perform
such further acts as may be reasonably required or desirable to carry out or to
perform the provisions of this Agreement.

            SECTION 4.11. Governing Law. This Agreement shall be governed by and
construed in accordance with the laws of the State of Delaware, without regard
to its conflict of laws principles.

            SECTION 4.12. Other Rights. The Company agrees that it will not
enter into, or cause or permit any of its Subsidiaries to enter into, any
agreement that conflicts with, limits or prohibits the exercise of the rights
granted to Cargill in this Agreement.

            SECTION 4.13. Consent to Jurisdiction: No Jury Trial. Any legal
action, suit or proceeding arising out of or relating to this Agreement may be
instituted in any federal court in the Southern District of New York, or in any
state court in which venue would otherwise be properly located in the Southern
District of New York, and each

                                                                               8

party waives any objection which such party may now or hereafter have to the
laying of the venue of any such action, suit or proceeding, and irrevocably
submits to the jurisdiction of any such court. Any and all service of process
and any other notice in any such action, suit or proceeding will be effective
against any party if given as provided herein. Nothing herein contained will be
deemed to affect the right of any party to serve process in any manner permitted
by law or to commence legal proceedings or otherwise proceed against any other
party in any jurisdiction other than New York. THE PARTIES HEREBY WAIVE TRIAL BY
JURY IN ANY ACTION, SUIT PROCEEDING OR COUNTERCLAIM BROUGHT BY EITHER OF THEM
AGAINST THE OTHER IN ANY MATTERS ARISING OUT OF OR IN ANY WAY CONNECTED WITH
THIS AGREEMENT.

            IN WITNESS WHEREOF, the undersigned have executed, or have caused to
be executed, this Agreement on the date first written above.

                                           BIOFUEL ENERGY CORP.

                                             by

                                                /s/ Scott H. Pearce
                                             -----------------------------------
                                             Name:  Scott H. Pearce
                                             Title: President & CEO

                                           CARGILL BIOFUELS INVESTMENTS, LLC

                                             by

                                                /s/ Patrick C. Bennett
                                             -----------------------------------
                                             Name: Patrick C. Bennett
                                             Title: Authorized Officer

                                                                      Schedule A

                               PROHIBITED PARTIES

Archer Daniels Midland Company
CHS Inc.
Tate & Lyle PLC
The Scoular Company
Bunge Limited