<PAGE>

                                                                     EXHIBIT 4.4
                                                               Execution Version

                           SEQUOIA HELOC TRUST 2004-1
                     HELOC ASSET-BACKED NOTES, SERIES 2004-1

                    MORTGAGE LOAN PURCHASE AND SALE AGREEMENT

                                     Between

                               RWT HOLDINGS, INC.

                                       and

                      SEQUOIA MORTGAGE FUNDING CORPORATION

                            dated as of June 1, 2004

<PAGE>

                                TABLE OF CONTENTS

<TABLE>
<CAPTION>
                                                                                            PAGE
                                                                                            ----
<S>                                                                                         <C>
Section 1.    Representations and Warranties of RWT and Sequoia.........................      1

Section 2.    Additional Representations, Warranties and
                   Agreements of RWT ...................................................      1

Section 3.    Conveyance of Mortgage Loans..............................................      2

Section 4.    Intention of Parties......................................................      3

Section 5.    Termination...............................................................      3

Section 6.    Miscellaneous.............................................................      4
</TABLE>

                                       i
<PAGE>

                    MORTGAGE LOAN PURCHASE AND SALE AGREEMENT

      This Mortgage Loan Purchase and Sale Agreement (the "Agreement") is made
as of June 1, 2004, by and between RWT Holdings, Inc., a Delaware corporation
("RWT") and Sequoia Mortgage Funding Corporation, a Delaware corporation
("Sequoia").

      WHEREAS, the parties hereto desire to provide for the purchase and sale of
the Mortgage Loans on the Closing Date (the "Mortgage Loans") (as defined in the
Indenture, dated as of June 1, 2004 (the "Indenture") by and among Sequoia HELOC
Trust 2004-1, as Issuer, and Wells Fargo Bank, N. A., as indenture trustee (the
"Trustee"), and acknowledged by RWT and Sequoia, in accordance with the terms
and conditions set forth in this Agreement.

      NOW, THEREFORE, the parties in consideration of good and valuable
consideration, the receipt and sufficiency of which is hereby acknowledged, and
intending to be legally bound, hereby agree as follows:

      Section 1.Representations and Warranties of RWT and Sequoia. RWT and
Sequoia, each as to itself and not the other, hereby represents, warrants and
agrees for the benefit of the other party that:

      (a)   Authorization. The execution, delivery and performance of this
Agreement by it are within its respective powers and have been duly authorized
by all necessary action on its part.

      (b)   No Conflict. The execution, delivery and performance of this
Agreement will not violate or conflict with (i) its charter or bylaws, (ii) any
resolution or other corporate action by it, or (iii) any decisions, statutes,
ordinances, rulings, directions, rules, regulations, orders, writs, decrees,
injunctions, permits, certificates or other requirements of any court or other
governmental or public authority in any way applicable to or binding upon it,
and will not result in or require the creation, except as provided in or
contemplated by this Agreement, of any lien, mortgage, pledge, security
interest, charge or encumbrance of any kind upon the Mortgage Loans.

      (c)   Binding Obligation. This Agreement has been duly executed by it and
is its legally valid and binding obligation, enforceable against it in
accordance with this Agreement's terms, except as enforceability may be limited
by bankruptcy, insolvency, reorganization, moratorium or similar laws affecting
creditors' rights generally, and by general principles of equity.

      Section 2. Additional Representations, Warranties and Agreements of RWT.

      (a)   RWT represents and warrants to, and agrees with, Sequoia that (i) on
the Closing Date, RWT will have good, valid and marketable title to the Mortgage
Loans that are identified in Schedule A to the Sale and Servicing Agreement and
the contractual rights with respect to the Mortgage Loans under each of the
Master Mortgage Loan Purchase Agreement and the Master Servicing Agreement, (as
modified by the related Acknowledgements, collectively referred to herein as the
"Purchase and Servicing Agreements") in each case free and clear of all liens,
mortgages, deeds of trust, pledges, security interests, charges, encumbrances or
other claims; and (ii) upon transfer to Sequoia, Sequoia will receive good,
valid and marketable title to all of the Mortgage Loans and will receive all of
RWT's contractual rights and obligations under each

                                       1
<PAGE>

such Purchase and Servicing Agreements, in each case free and clear of any
liens, mortgages, deeds of trust, pledges, security interests, charges,
encumbrances or other claims.

      (b)   RWT hereby makes the representations and warranties as to the
Mortgage Loans set forth in Schedule A to this Agreement, for the benefit of
Sequoia and the Trustee.

      (c)   RWT hereby agrees that it will comply with the provisions of Section
2.05 of the Sale and Servicing Agreement in respect of a breach of any of the
representations and warranties set forth in this Section 2.

      (d)   RWT hereby represents and warrants for the benefit of Sequoia and
the Trustee: (i) this Agreement creates a valid and continuing security interest
(as defined in the applicable UCC) in the Mortgage Loans in favor of Sequoia,
which security interest is prior to all other Liens, and is enforceable as such
as against creditors of and purchasers from RWT; (ii) the Mortgage Loans
constitute "instruments" within the meaning of the applicable UCC; (iii) RWT,
immediately prior to its transfer of Mortgage Loans under this Agreement, will
own and have good, valid and marketable title to the Mortgage Loans free and
clear of any Lien, claim or encumbrance of any Person; (iv) RWT has received all
consents and approvals required by the terms of the Mortgage Loans to the sale
of the Mortgage Loans hereunder to Sequoia; (v) all original executed copies of
each Mortgage Note that constitute or evidence the Mortgage Loans have been
delivered to the applicable Custodian; (vi) RWT has received a written
acknowledgment from the applicable Custodian that such Custodian is holding the
Mortgage Notes that constitute or evidence the Mortgage Loans solely on behalf
and for the benefit of Sequoia; (vii) other than the security interest granted
to Sequoia pursuant to this Agreement and security interests granted to lenders
which will be automatically released at the Closing, RWT has not pledged,
assigned, sold, granted a security interest in, or otherwise conveyed any of the
Mortgage Loans; RWT has not authorized the filing of and is not aware of any
financing statements against it that include a description of collateral
covering the Mortgage Loans other than any financing statement relating to the
security interest granted to Sequoia hereunder or that will be automatically
released upon the sales to Sequoia; (viii) RWT is not aware of any judgment or
tax lien filing against itself; and (ix) none of the Mortgage Notes that
constitute or evidence the Mortgage Loans have any marks or notations indicating
that they have been pledged, assigned or otherwise conveyed to any Person other
than Sequoia.

      Section 3. Conveyance of Mortgage Loans.

      (a)   Mortgage Loans. RWT, concurrently with the execution and delivery
hereof, hereby sells, transfers, assigns, sets over and otherwise conveys to
Sequoia, without recourse, all of RWT's right, title and interest in and to (i)
each Mortgage Loan, including its Principal Balance (including any Additional
Balances related thereto) and all collections in respect of the Mortgage Loans
conveyed to the Trust and received (or, in the case of Interest Collections,
due) (A) in the case of Interest Collections, with respect to the Principal
Balance thereof as of the Cut-off Date, after the close of business on the
Cut-Off Date and (B) in the case of all Principal Collections, and Interest
Collections on Additional Balances created after the Cut-Off Date, after the
close of business on the Issue Date; (ii) RWT's rights under the Purchase and
Servicing Agreements; (iii) property that secured a Mortgage Loan that is
acquired by foreclosure or deed in lieu of foreclosure; (iv) RWT's rights under
the hazard insurance policies; (v) the Policy; (vi) the Collection Account and
the Distribution Account; and (vii) any proceeds of the foregoing and any other
Trust Property and all other assets included or to be included in the Trust for
the benefit of Noteholders, the Residual Certificateholders and the Insurer.

                                       2
<PAGE>

      On or prior to the Closing Date, RWT shall deliver to Sequoia or, at
Sequoia's direction, to the applicable Custodian, the Trustee's Mortgage File
for each Mortgage Loan in the manner set forth in Section 2 of the Custody
Agreement. Release of the Trustee's Mortgage Files on the Closing Date shall be
made against payment by Sequoia of the purchase price for the Mortgage Loans and
related assets, which shall be a cash payment wired to RWT's account. The amount
of the purchase price payable by Sequoia shall be set forth in writing in a
separate letter.

      (b)   Defective Mortgage Loans. If any Mortgage Loan is required to be
repurchased due to defective or missing documentation pursuant to Section 2.05
of the Sale and Servicing Agreement, RWT shall, at its option, either (a)
repurchase or cause the applicable seller of such Mortgage Loan to RWT to
repurchase such Mortgage Loan at the Purchase Price, or (b) provide or cause the
applicable seller of such Mortgage Loan to RWT to provide a Replacement Mortgage
Loan, subject to the terms and conditions of the Sale and Servicing Agreement.

      Section 4. Intention of Parties. It is the express intent of the parties
hereto that (without addressing characterization for GAAP purposes) the
conveyance of the Mortgage Loans by RWT to Sequoia be construed as, an absolute
sale thereof. It is, further, not the intention of the parties that such
conveyance be deemed a pledge thereof. However, in the event that,
notwithstanding the intent of the parties, such assets are held to be the
property of the assigning party, or if for any other reason this Agreement is
held or deemed to create a security interest in the Mortgage Loans, then (i)
this Agreement shall be deemed to be a security agreement within the meaning of
the Uniform Commercial Code of the State of New York and (ii) the conveyance
provided for in this Agreement shall be deemed to be an assignment and a grant
by RWT to Sequoia of a security interest in all of the assets described in such
conveyances, whether now owned or hereafter acquired.

      RWT and Sequoia shall, to the extent consistent with this Agreement, take
such actions as may be necessary to ensure that, if this Agreement were deemed
to create a security interest in the Mortgage Loans, such security interest
would be deemed to be a perfected security interest of first priority under
applicable law and will be maintained as such throughout the term of this
Agreement. RWT shall arrange for filing any Uniform Commercial Code continuation
statements in connection with any security interest granted or assigned
hereunder.

      Section 5. Termination.

      (a)   Sequoia may terminate this Agreement, by notice to RWT, at any time
at or prior to the Closing Date:

            (i)   if the Underwriting Agreement is terminated by the
      Underwriters pursuant to the terms of the Underwriting Agreement or if the
      Underwriters do not complete the transactions contemplated by the
      Underwriting Agreement as the result of the failure of any condition set
      forth therein or if there has been, since the time of execution of this
      Agreement or since the respective dates as of which information is given
      in the Prospectus or Prospectus Supplement, any material adverse change in
      the financial condition, earnings, business affairs or business prospects
      of RWT, whether or not arising in the ordinary course of business, or

            (ii)  if there has occurred any material adverse change in the
      financial markets in the United States, any outbreak of hostilities or
      escalation thereof or other calamity or crisis or any change or
      development involving a prospective change in national or international
      political, financial or economic conditions, in each case the effect of
      which

                                       3
<PAGE>

      is such as to make it, in the judgment of the Underwriters, impracticable
      to market the Notes or to enforce contracts for the sale of the Notes, or

            (iii) if a banking moratorium has been declared by either Federal or
      New York authorities.

      (b)   This Agreement shall terminate automatically without any required
notice or other action by any party hereto if the Closing Date for the issuance
of the Notes has not occurred by July 15, 2004.

      (c)   Notwithstanding any termination of this Agreement or the completion
of all sales contemplated hereby, the representations, warranties and agreements
in Sections 1 and 2 hereof shall survive and remain in full force and effect.

      Section 6. Miscellaneous.

      (a)   Amendments, Etc. No rescission, modification, amendment, supplement
or change of this Agreement shall be valid or effective unless in writing and
signed by all of the parties to this Agreement. No amendment of this Agreement
may modify or waive the representations, warranties and agreements set forth in
Sections 1 and 2 hereof.

      (b)   Binding Upon Successors, Etc. This Agreement shall bind and inure to
the benefit of and be enforceable by RWT and Sequoia, and the respective
successors and assigns thereof. The parties hereto acknowledge that Sequoia is
acquiring the Mortgage Loans for the purpose of pledging, transferring,
assigning, setting over and otherwise conveying them to the Trustee, pursuant to
the Sale and Servicing Agreement for inclusion in the Trust Fund. As an
inducement to Sequoia to purchase the Mortgage Loans, RWT acknowledges and
consents to the assignment to the Trustee by Sequoia of all of Sequoia's rights
against RWT hereunder in respect of the Mortgage Loans sold to Sequoia and that
the enforcement or exercise of any right or remedy against RWT hereunder by the
Trustee or to the extent permitted under the Sale and Servicing Agreement shall
have the same force and effect as if enforced and exercised by Sequoia directly.

      (c)   Counterparts. This Agreement may be executed in two or more
counterparts, each of which shall be deemed an original but all of which
together shall constitute one and the same instrument.

      (d)   Governing Law. This Agreement shall be governed by and construed in
accordance with the laws of the State of New York.

      (e)   Headings. The headings of the several parts of this Agreement are
inserted for convenience of reference and are not intended to be a part of or
affect the meaning or interpretation of this Agreement.

      (f)   Definitions. Capitalized terms not otherwise defined herein have the
meanings ascribed to such terms in the Indenture.

      (g)   Nonpetition Covenant. Until one year plus one day shall have elapsed
since the termination of the Sale and Servicing Agreement in accordance with its
terms, neither RWT nor any assignee of RWT shall petition or otherwise invoke
the process of any court or government authority for the purpose of commencing
or sustaining a case against Sequoia under any federal

                                       4
<PAGE>

or state bankruptcy, insolvency or similar law or appointing a receiver,
liquidator, assignee, trustee, custodian, sequestrator or other similar official
of Sequoia or any substantial part of its property, or ordering the winding up
or liquidation of the affairs of Sequoia.

                  [remainder of page intentionally left blank]

                                       5
<PAGE>

      IN WITNESS WHEREOF, each party has caused this Mortgage Loan Purchase and
Sale Agreement to be executed by its duly authorized officer or officers as of
the day and year first above written.

                                         RWT HOLDINGS, INC.

                                         By:____________________________________
                                         Name:__________________________________
                                         Title:_________________________________

                                         SEQUOIA MORTGAGE FUNDING
                                         CORPORATION

                                         By:____________________________________
                                         Name:__________________________________
                                         Title:_________________________________

                                       6
<PAGE>

                                   SCHEDULE A

                                        1