Exhibit 4.2





 Exhibit 4.2 

RISK RETENTION AGREEMENT, dated as of July 31, 2018 (this “Agreement”), by and among DISCOVER BANK, a Delaware banking
corporation (“Discover Bank”), DISCOVER FUNDING LLC, a Delaware limited liability company (“Discover Funding”), and DISCOVER CARD EXECUTION NOTE TRUST, a Delaware statutory trust (the “Issuer”).

 WITNESSETH: 
 WHEREAS,
Discover Bank and Discover Funding have entered into a Receivables Sale and Contribution Agreement, dated as of December 22, 2015 (the “Receivables Sale and Contribution Agreement”), pursuant to which Discover Bank sells to
Discover Funding Receivables arising under certain Accounts; 
 WHEREAS, Discover Bank, Discover Funding, and U.S. Bank National
Association, as trustee (in such capacity, the “Trustee”), have entered into a Third Amended and Restated Pooling and Servicing Agreement, dated as of December 22, 2015 (as amended, restated, supplemented or otherwise modified,
the “Pooling and Servicing Agreement”) and an Amended and Restated Series Supplement, dated as of December 22, 2015 (as amended, restated, supplemented or otherwise modified, the “Series Supplement”), pursuant
to which Discover Card Master Trust I issued a Series 2007-CC Collateral Certificate (the “Collateral Certificate”); 

WHEREAS, Discover Bank and the Issuer have entered into a Collateral Certificate Transfer Agreement, dated as of July 26, 2007 (as
amended, restated, supplemented or otherwise modified, the “Collateral Certificate Transfer Agreement”), pursuant to which Discover Bank conveyed to the Issuer all of its right, title and interest in and to the Collateral
Certificate; 
 WHEREAS, the Issuer and U.S. Bank National Association (the “Indenture Trustee”) have entered into an
Amended and Restated Indenture, dated as of December 22, 2015 (as amended, restated, supplemented or otherwise modified, the “Indenture”), and the Second Amended and Restated Indenture Supplement, dated as of December 22,
2015 (as amended, restated, supplemented or otherwise modified, the “Indenture Supplement”), pursuant to the Issuer has issued and may from time to time issue notes; and 

WHEREAS, Discover Funding intends to cause the Issuer to issue the Class A(2018-4) Notes pursuant
to the Indenture and the Terms Document, dated as of July 31, 2018, between the Issuer and the Indenture Trustee. 
 NOW, THEREFORE, it
is hereby agreed by and between Discover Bank, Discover Funding and the Issuer as follows: 
 1. DEFINITIONS. All capitalized terms
used but not defined herein shall have the meanings given to such terms in the Terms Document and, if not defined therein, in the Indenture and, if not defined therein, in the Pooling and Servicing Agreement. The following capitalized terms shall
have the following meanings: 
 “AIFM Regulation” means Commission Delegated Regulation (EU) No. 231/2013, as in effect
as of the date hereof. 












 “Applicable Investor” means each holder of a beneficial interest in any Class A(2018-4) Note that is (i) an EEA credit institution or investment firm subject to the CRR, including any consolidated group affiliate thereof; (ii) an EEA insurer or reinsurer subject to the
Solvency II Regulation; or (iii) an EEA alternative investment fund manager to which the AIFM Regulation applies. 

“CRR” means Regulation (EU) No. 575/2013 of the European Parliament and of the Council of 26 June 2013, as
supplemented by the CRR Delegated Regulation, as in effect as of the date hereof. 
 “CRR Delegated Regulation” means
Commission Delegated Regulation (EU) No. 625/2014, as in effect as of the date hereof. 
 “EEA” means the European
Economic Area. 
 “EU Retention Rules” means: (i) Articles 404 – 410 (inclusive) of CRR; (ii) Articles 50
– 56 (inclusive) of the AIFM Regulation; and (iii) Articles 254 – 257 (inclusive) of the Solvency II Regulation, each as in effect as of the date hereof, together with any guidance published in relation thereto including any
regulatory and/or implementing technical standards in effect as of the date hereof. 
 “Solvency II Regulation” means
Commission Delegated Regulation ((EU No. 2015/35), as in effect as of the date hereof. 
 2. REPRESENTATIONS. Discover Bank
represents and warrants to the Issuer and the Indenture Trustee (solely for the benefit of the Applicable Investors) that as of the date hereof: 

(a) Discover Bank has full corporate power and authority to execute and deliver this Agreement and perform the terms and
provisions hereof; 
 (b) The execution, delivery and performance of this Agreement have been duly authorized by all
necessary corporate action, and do not require any approval or consent of any governmental agency or authority; and 
 (c)
This Agreement is the valid, binding and enforceable obligation of Discover Bank, except as the same may be limited by receivership, insolvency, reorganization, moratorium or other laws relating to the enforcement of creditors’ rights generally
or by general equity principles. 
 3. COVENANTS. Discover Bank hereby confirms, represents and warrants to and agrees with, and
irrevocably and unconditionally undertakes to the Issuer and the Indenture Trustee, solely for the benefit of each Applicable Investor, in connection with the EU Retention Rules, on an ongoing basis, that: 

(a) Discover Bank, as “originator” for the purposes of the EU Retention Rules, currently retains, and on an ongoing
basis will retain, a material net economic interest that is not less than 5% of the nominal value of the securitized exposures, in a form 

  
 2 













 
that is intended to qualify as an originator’s interest as provided in option (b) of each of Article 405(1) of the CRR, Article 51(1) of the AIFM Regulation and Article 254(2) of the
Solvency II Regulation, by holding all the membership interest in Discover Funding, which in turn holds all or part of the Transferor Interest (the “Retained Interest”); 

(b) Discover Bank will not (and will not permit Discover Funding or any of its other affiliates to) allow the retained interest
to be subject to any credit risk mitigation, short position or other hedge or to be sold if, as a result, Discover Bank would not retain a material net economic interest in an amount that is not less than 5% of the nominal value of the securitized
exposures, except to the extent permitted in accordance with Article 405(1) of the CRR (as supplemented by Article 12 of the CRR Delegated Regulation), Article 51(1) of the AIFM Regulation and Article 254 of the Solvency II Regulation; 

(c) Discover Bank will not change the manner in which it retains its net economic interest in the securitized exposures while
the Class A(2018-4) Notes are outstanding, except under exceptional circumstances in accordance with Article 405(1) of the CRR (as supplemented by Article 10 of the CRR Delegated Regulation), Article
51(1) of the AIFM Regulation and Article 254 of the Solvency II Regulation; and 
 (d) Discover Bank will provide ongoing
confirmation of Discover Bank’s continued compliance with its obligations described in (a) and (b) above in or concurrently with the delivery of each Certificateholders’ Monthly Statement. 

4. AGREEMENTS OF DISCOVER FUNDING. Discover Funding hereby acknowledges the terms and conditions of this Agreement and, further,
covenants that it will not sell, hedge or otherwise mitigate its credit risk under or associated with the Retained Interest other than as directed by Discover Bank and as permitted in accordance with the terms of this Agreement. 

5. LIMITATION OF LIABILITY. 

(a) It is expressly understood and agreed by the parties hereto that (i) this Agreement is executed and delivered by
Wilmington Trust Company not individually or personally but solely as Owner Trustee under the Amended and Restated Trust Agreement, dated as of December 22, 2015 (the “Trust Agreement”), between Discover Funding LLC and
Wilmington Trust Company, and in the exercise of the powers and authority conferred and vested in it, (ii) each of the representations, undertakings and agreements herein made on the part of the Issuer is made and intended not as a personal
representation, undertaking or agreement by Wilmington Trust Company but is made and intended for the purpose of binding only the Issuer, (iii) nothing herein contained will be construed as creating any liability on the Wilmington Trust Company
individually or personally, to perform any covenant of the Issuer either expressed or implied herein, all such liability, if any, being expressly waived by the parties to this Agreement and by any person claiming by, through or under them and
(iv) under no circumstances will Wilmington Trust Company be personally liable for the payment of any indebtedness or expenses of the Issuer or be liable for the breach or failure of any obligation, representation, warranty or covenant made or
undertaken by the Issuer under this Agreement or any related documents. 

  
 3 













 (b) Notwithstanding anything to the contrary contained herein or in any
other document or agreement relating to the Class A(2018-4) Notes, in no event shall Discover Bank or Discover Funding be liable to the Indenture Trustee, the Issuer, the Owner Trustee, any
Applicable Investor or any other Noteholder, or responsible for, losses in respect of the Class A(2018-4) Notes or any interest therein, including, without limitation any loss of value of
any Class A(2018-4) Note or any interest therein, due to the failure of the Retained Interest and compliance by Discover Bank and Discover Funding with the terms of this Agreement to satisfy
the EU Retention Rules or other similar or equivalent provisions now or hereafter in effect. 
 6. MISCELLANEOUS. 

(a) THIS AGREEMENT WILL BE CONSTRUED IN ACCORDANCE WITH AND GOVERNED BY THE LAWS OF THE STATE OF NEW YORK, INCLUDING SECTION 5-1401 OF THE GENERAL OBLIGATION LAW, WITHOUT REFERENCE TO ANY CONFLICT OF LAW PROVISIONS THAT WOULD RESULT IN THE APPLICATION OF THE LAWS OF ANY OTHER STATE. 

(b) EACH OF THE PARTIES HERETO (AND EACH APPLICABLE INVESTOR BY ACCEPTING THE BENEFITS HEREOF) HEREBY AGREES TO THE EXCLUSIVE
JURISDICTION OF ANY STATE OR FEDERAL COURT LOCATED WITHIN THE STATE OF NEW YORK. EACH OF THE PARTIES HERETO HEREBY WAIVES ANY OBJECTION BASED ON FORUM NON CONVENIENS, AND ANY OBJECTION TO VENUE OF ANY ACTION INSTITUTED HEREUNDER IN ANY OF THE
AFOREMENTIONED COURTS AND CONSENTS TO THE GRANTING OF SUCH LEGAL OR EQUITABLE RELIEF AS IS DEEMED APPROPRIATE BY SUCH COURT. 

(c) All notices and other communications provided for hereunder shall, unless otherwise stated herein, be in writing (including
telecopies, email, telegraphic, telex or cable communication) and mailed, emailed (with “PDF” attachment in the case of any signed notice or communication), telecopied with receipt confirmed by telephone, telegraphed, telexed, cabled or
delivered, as to each party hereto, at its address set forth below or at such other address as shall be designated by such party in a written notice to the other party hereto. All such notices and communications shall, when mailed, emailed,
telecopied, telegraphed, telexed or cabled, be effective when deposited in the mail, emailed, telecopied, delivered to the telegraph company, confirmed by telex answer back or delivered to the cable company, respectively. 

  
 4 













 If to Discover Bank: 

12 Read’s Way 
 New Castle,
Delaware 19720 
 Attention: Secretary 

If to Discover Funding: 
 12
Read’s Way 
 New Castle, Delaware 19720 

Attention: Secretary 
 If to the
Issuer: 
 c/o Wilmington Trust Company 

Rodney Square North 
 1100 North
Market Street 
 Wilmington, Delaware 19890 

Attention: Corporate Trust Administration 

(d) Neither this Agreement nor any term or provision hereof may be changed, waived, discharged or terminated except by a
writing signed by a duly authorized officer of the party against whom enforcement of such change, waiver, discharge or termination is sought to be enforced. 

(e) Any part, provision, representation, warranty or covenant of this Agreement that is prohibited or is held to be void or
unenforceable shall be ineffective to the extent of such prohibition or unenforceability without invalidating the remaining provisions hereof. 

Any part, provision, representation, warranty or covenant of this Agreement that is prohibited or is held to be void or
unenforceable in any particular jurisdiction shall, as to such jurisdiction, be ineffective to the extent of such prohibition or unenforceability without invalidating the remaining provisions hereof, and any such prohibition or unenforceability in
any particular jurisdiction shall not invalidate or render unenforceable such provision in any other jurisdiction. 
 To the
extent permitted by applicable law, the parties hereto waive any provision of law which prohibits or renders void or unenforceable any provision hereof. 

(f) This Agreement constitutes the entire agreement and understanding of the parties with respect to the matters addressed
herein, and this Agreement supersedes any prior agreements and/or understandings, written or oral, with respect to such matters. 

(g) The Issuer is a party to this Agreement solely for the purposes of obtaining the benefit of the representations,
warranties and covenants contained therein and under no circumstances shall it be deemed to have undertaken any obligations thereunder or by virtue of its entry into this Agreement. 

  
 5 













 (h) The Indenture Trustee is a third party beneficiary of this Agreement
solely for the purpose of obtaining the benefit of the representations, warranties and covenants contained herein and under no circumstances shall it be deemed to have undertaken any obligations hereunder. For the avoidance of doubt, in no event
shall the Indenture Trustee have any responsibility to monitor compliance with or be charged with knowledge of the EU Retention Rules, nor shall it be liable to any Applicable Investor, Noteholder or any party whatsoever for any violation of such EU
Retention Rules or such similar provisions now or hereafter in effect or for any breach of any term of this Agreement. 

  
 6 













 Discover Bank, Discover Funding and the Issuer have caused this Agreement to be duly
executed by their respective officers as of the date first above written. 
  

			
	DISCOVER BANK
		
	By: 	 	/s/ Michael F. Rickert
	Name: Michael F. Rickert
	Title:   Vice President, Chief Financial Officer and Assistant Treasurer


  

			
	DISCOVER FUNDING LLC
		
	By: 	 	/s/ Michael F. Rickert
	Name: Michael F. Rickert
	Title:   Vice President, Chief Financial Officer and Treasurer


  

			
	DISCOVER CARD EXECUTION NOTE TRUST
		
	By:	 	Wilmington Trust Company, not in its individual capacity, but solely as Owner Trustee


  

			
		
	By: 	 	/s/ Jennifer A. Luce
		 	Name: Jennifer A. Luce
		 	Title: Vice President



  
 7