Harleysville National Corp. and East Penn Financial Corp., two banks with operations north of Philadelphia, agreed to a merger worth between $86.3 million and $99.1 million in cash and stock, the banks said today.

The final price depends on the performance of Harleysville's shares before the deal closes.

The announcement sent shares in East Penn, of Emmaus, up $5.38 or 66.5 percent, this morning. Founded in 1990, East Penn has $451 million in assets and operates nine branches in Lehigh, Northampton and Berks Counties.

As part of the proposed deal, nine of Harleysville National's branches, including those in Lehigh, Carbon, Monroe, and Northampton Counties, will be transferred to the East Penn division, the companies said.

Harleysville's shares gained 17 cents, or 1 percent in early trading, reaching $16.