SHUMAKER WILLIAMS, P.C. P.O. BOX 88 HARRISBURG, PA 17108 (717) 763-1121 April 30, 1998 Mr. Eugene F. Shaffer Mr. Franklin W. Ruth, Jr. President, Chairman and CEO President and CEO Mid Penn Bancorp, Inc. Miner's Bank of Lykens 349 Union Street 550 Main Street Millersburg, PA 17061 Lykens, PA 17048 RE: Merger of Miner's Bank of Lykens Our File No. 517-98 Gentlemen: We have acted as special counsel to Mid Penn Bancorp, Inc. ("Bancorp") and its wholly-owned subsidiary, Mid Penn Bank ("Mid Penn"), in connection with the registration under the Securities Act of 1933, as amended, by means of a registration statement on Form S-4 (the "Registration Statement") of 148,250 shares of the common stock of Bancorp, par value $1.00 per share (the "Bancorp Common Stock") to be issued pursuant to the terms of an Agreement and Plan of Reorganization, dated January 9, 1998, (the "Agreement") entered into among Bancorp, Mid Penn and Miner's Bank of Lykens ( the "Bank"). Upon consummation of the transaction contemplated by the Agreement: (i) the Bank will merge with, into and under the charter of Mid Penn (the "Merger"); (ii) Mid Penn will survive the Merger; (iii) all of the outstanding shares of common stock of the Bank, par value $5.00 per share (the "Bank Common Stock") will be converted into the right to receive ten (10) shares of Bancorp Common Stock; and (iv) each shareholder of the Bank will receive cash in lieu of any fractional shares of Bancorp Common Stock. Mr. Eugene F. Shaffer President, Chairman and CEO Mid Penn Bancorp, Inc. Mr. Franklin W. Ruth President and CEO Miners Bank of Lykens - ----------------- Page 2 This opinion is rendered pursuant to the requirements of Item 601(b)(5)(i) of Regulation S-K of the Securities and Exchange Commission (17 C.F.R. ss.229.601(b)(5)(i)) for inclusion as an exhibit to the Registration Statement. In connection with the preparation of this opinion, we have examined such documents and corporate and other records and questions of law as we deem necessary or appropriate. Based upon the foregoing and subject to the conditions that: (i) all conditions precedent to the obligations of the parties set forth in the Agreement will have been satisfied at the time of the Merger; (ii) all covenants required to be performed by the parties as set forth in the Agreement will have been performed by them at the time of the Merger; and (iii) the shares of Bancorp Common Stock will be issued in strict accordance with the terms of the Agreement, we are of the opinion that the Bancorp Common Stock has been duly authorized and, when issued, will be legally issued, fully paid and non-assessable. In rendering the foregoing opinion, we have assumed without investigation that: (i) Bank has full corporate power and authority to execute and deliver the Agreement and to carry out the transactions contemplated therein; (ii) the Agreement has been duly executed and delivered by Bank and constitutes a valid and binding obligation of Bank; (iii) all corporate actions required to be taken by Bank to authorize the execution and delivery of the Agreement and the performance of the transactions contemplated therein will have been taken at the time of the Merger; and (iv) the shares of Bank Common Stock issued and outstanding at the time of the Merger are duly authorized, validly issued, fully paid and non-assessable. We hereby consent to the inclusion of this opinion as an exhibit to the Registration Statement and to the reference to our firm in the section of the Registration Statement entitled "Legal Opinions". SHUMAKER WILLIAMS, P.C. /s/ Nicholas Bybel, Jr. ------------------------------- By: Nicholas Bybel, Jr.