Exhibit 10.4

Residential Capital, LLC / Residential Funding Securities, LLC Expense Sharing Agreement

Residential Capital, LLC (ResCap) is a
wholly-owned subsidiary of GMAC LLC (GMAC), the direct parent of Residential Funding Securities, LLC (RFS). As such, ResCap is an affiliate of RFS. Certain RFS personnel are employed and supported by ResCap or ResCap affiliates.

ResCap incurs operating expenses on behalf of itself, RFS and other affiliates, including without limitation payroll and payroll related, subscription, education,
professional, advertising, equipment rental, repairs and maintenance, printing and stationery, office supplies, postage and courier, telephone, travel, meals, entertainment, conferences, rent and operating, liability insurance, and bank charge
expenses. To reflect the operating expenses attributable to RFS operations that ResCap pays, ResCap and RFS are entering into this Agreement, effective May 1, 2009 (the Effective Date).

Expense Calculation. All operating expenses incurred by ResCap will be posted in accordance with ResCaps normal accounting and control procedures. At
the end of each month, ResCap will charge to RFS a percentage (the Allocation Factor) of the expenses recorded in the cost center(s) listed on Exhibit A attached hereto (the Allocated Expenses) for that calendar month. RFS
will pay ResCap for such expenses on a monthly basis for the preceding month. The Allocation Factor set forth above, as adjusted from time to time in accordance with this Agreement, is estimated to reflect all operating expenses related to the
business of RFS.

Exclusions from Expense Calculation. In determining which operating expenses will be considered in the calculation required
by the preceding paragraph, prior to application of the Allocation Factor, all amounts recorded in such cost centers and attributable to Corporate Allocations will be excluded from operating expenses.

The parties may from time to time amend the list of cost centers shown on Exhibit A by Memorandum executed by any authorized signatories on their behalf. In addition,
the parties may by memorandum adjust the Allocation Factor based on (i) changes to the business and operation of RFS and the enterprise operating unit of which it is a part, (ii) changes in headcount in the cost centers listed on Exhibit A
or (iii) unanticipated or extraordinary expenses incurred and attributable to the business of RFS.

Signature Page Follows



---

As of the Effective Date, this Agreement supersedes all prior understandings between ResCap and RFS with respect to the
matters addressed herein:



|                         |  |                    |  |                                     |  |     |  |                
|------------------------ |  | ------------------ |  | ----------------------------------- |  | --- |  | ---------------
|Residential Capital, LLC |  |                    |  | Residential Funding Securities, LLC
|                         |  |                    |  |                                    
|By:                      |  | /s/ James N. Young |  |                                     |  | By: |  | /s/ Robert Cole
|James N. Young, CFO      |  |                    |  | Robert Cole / President            
|(Print Name and Title)   |  |                    |  | (Print Name and Title)             
|                         |  |                   
|Dated: 5/1/2009          |  |                    |  | Dated: 4/30/2009                   



| |  |  |  |                                     
| |  |  |  | ------------------------------------
| |  |  |  | ResCap/RFS Expense Sharing Agreement



---

Exhibit A

Cost Centers 3063, 3094, 4252, ACC021, 3370



| |  |  |  |                                     
| |  |  |  | ------------------------------------
| |  |  |  | ResCap/RFS Expense Sharing Agreement