EXHIBIT 5.1 June 28, 1999 Residential Asset Funding Corporation 301 South College Street Charlotte, North Carolina 28202-6001 Ladies and Gentlemen: We have acted as counsel to Residential Asset Funding Corporation, a North Carolina corporation (the "Company"), in connection with the preparation of the registration statement on Form S-3 (the "Registration Statement") relating to the proposed offering from time to time in one or more series (each, a "Series") of up to $__________ aggregate principal amount of asset backed notes (the "Notes") and asset backed certificates (the "Certificates," and, together with the Notes, the "Securities"). The Registration Statement will be filed with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Act"). As set forth in the Registration Statement, each Series of Securities is to be issued under and pursuant to the terms of a separate pooling and servicing agreement, sale and servicing agreement, pooling agreement, trust agreement or indenture (each, an "Agreement") among the Company, an independent trustee (the "Trustee") and where appropriate, a servicer (the "Servicer"), each to be identified in the prospectus supplement for such Series of Securities. As such counsel, we have examined copies of the Articles of Incorporation and Bylaws of the Company, the Registration Statement, the Prospectus and each form of Prospectus Supplement included therein, the form of each Agreement, and originals or copies of such other corporate minutes, records, agreements and other instruments of the Company, certificates of public officials and other documents and have made such examinations of law, as we have deemed necessary to form the basis for the opinion hereinafter expressed. In our examination of such materials, we have assumed the genuineness of all signatures, the authenticity of all documents submitted to us as originals and the conformity to original documents of all copies submitted to us. We do not express any opinion herein concerning any law other than the federal laws of the United States of America and the laws of the States of New York and North Carolina. Based upon and subject to the foregoing, we are of the opinion that: 1. When the Notes have been duly executed and delivered, authenticated by the Trustee and sold as described in the Registration Statement, the Notes will constitute valid and binding obligations of the issuer thereof in accordance with their terms and the terms of such Residential Asset Funding Corporation June 28, 1999 Page 2 Agreement or Agreements, and will be legally issued, fully paid and non-assessable. This opinion is subject to the effect of bankruptcy, insolvency, moratorium, fraudulent conveyance and similar laws relating to or affecting creditors' rights generally and court decisions with respect thereto and we express no opinion with respect to the application of equitable principles or remedies in any proceeding, whether at law or in equity. 2. When the Certificates have been duly executed and delivered, authenticated by the Trustee and sold as described in the Registration Statement, the Certificates will be legally issued, fully paid and non-assessable. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement and to the references to this firm under the caption "Legal Matters" in the Prospectus which forms a part of the Registration Statement. In giving such consent, we do not admit hereby that we come within the category of persons whose consent is required under Section 7 of the Act or the Rules and Regulations of the Commission thereunder. Very truly yours, /s/ Dewey Ballantine LLP ------------------------ 2