EX-5.1 2 d906633dex51.htm EX-5.1

Exhibit 5.1

|  | Hogan Lovells US LLP Columbia Square 555 Thirteenth Street, NW Washington, DC 20004 T +1 202 637 5600 F +1 202 637 5910 www.hoganlovells.com

February 20, 2025

Board of Directors

CNB Financial Corporation

1 South Second Street

PO Box 42

Clearfield, Pennsylvania 16830

To the addressee referred to above:

We are acting as counsel to CNB Financial Corporation, a Pennsylvania corporation (the “Company”), in connection with its registration statement on Form S-4, as amended (the “Registration Statement”), filed with the Securities and Exchange Commission under the Securities Act of 1933, as amended (the “Act”), relating to the proposed offering of up to 8,679,192 shares of the common stock, no par value per share, of the Company (the “Shares”) in connection with the merger contemplated by the Agreement and Plan of Merger, dated as of January 9, 2025 (the “Merger Agreement”), by and among the Company, CNB Bank, ESSA Bancorp, Inc. and ESSA Bank & Trust. This opinion letter is furnished to you at your request to enable you to fulfill the requirements of Item 601(b)(5) of Regulation S-K, 17 C.F.R. § 229.601(b)(5), in connection with the Registration Statement.

For purposes of this opinion letter, we have examined copies of such agreements, instruments and documents as we have deemed an appropriate basis on which to render the opinions hereinafter expressed. In our examination of the aforesaid documents, we have assumed the genuineness of all signatures, the legal capacity of all natural persons, the accuracy and completeness of all documents submitted to us, the authenticity of all original documents, and the conformity to authentic original documents of all documents submitted to us as copies (including pdfs). As to all matters of fact, we have relied on the representations and statements of fact made in the documents so reviewed, and we have not independently established the facts so relied on. This opinion letter is given, and all statements herein are made, in the context of the foregoing.

This opinion letter is based as to matters of law solely on the Pennsylvania Business Corporation Law of 1988, as amended. We express no opinion herein as to any other statutes, rules or regulations.

Based upon, subject to and limited by the foregoing, we are of the opinion that following (i) effectiveness of the Registration Statement and (ii) issuance of the Shares in accordance with the terms of the Merger Agreement, the Shares will be validly issued, fully paid, and nonassessable.

Hogan Lovells US LLP is a limited liability partnership registered in the state of Delaware. “Hogan Lovells” is an international legal practice that includes Hogan Lovells US LLP and Hogan Lovells International LLP, with offices in: Alicante Amsterdam Baltimore Beijing Berlin Birmingham Boston Brussels Colorado Springs Denver Dubai Dublin Dusseldorf Frankfurt Hamburg Hanoi Ho Chi Minh City Hong Kong Houston Johannesburg London Los Angeles Luxembourg Madrid Mexico City Miami Milan Minneapolis Monterrey Munich New York Northern Virginia Paris Philadelphia Riyadh Rome San Francisco São Paulo Shanghai Silicon Valley Singapore Sydney Tokyo Warsaw Washington, D.C. Associated Offices: Budapest Jakarta Shanghai FTZ. Business Service Centers: Johannesburg Louisville. For more information see www.hoganlovells.com

This opinion letter has been prepared for use in connection with the Registration Statement. We assume no obligation to advise of any changes in the foregoing subsequent to the effective date of the Registration Statement.

We hereby consent to the filing of this opinion letter as Exhibit 5.1 to the Registration Statement and to the reference to this firm under the caption “Legal Matters” in the prospectus constituting a part of the Registration Statement. In giving this consent, we do not thereby admit that we are an “expert” within the meaning of the Act.

Very truly yours,

/s/ Hogan Lovells US LLP

HOGAN LOVELLS US LLP