<PAGE>
                                                                        EX 10.65

                SECOND AMENDMENT TO LOAN AND SECURITY AGREEMENT

         THIS SECOND AMENDMENT TO LOAN AND SECURITY AGREEMENT ("AMENDMENT") is
made effective as of the 23rd day of June, 2004 by and between WACHOVIA
BANK, NATIONAL ASSOCIATION, successor by specific assignment to Congress
Financial Corporation ("LENDER"), and IMPAX LABORATORIES, INC. ("BORROWER").

                                   BACKGROUND

         A. Lender and Borrower are parties to that certain Loan and Security
Agreement dated October 23, 2002 (as amended by that certain First Amendment to
Loan and Security Agreement dated December 2, 2003 between Borrower and Lender
and as the same may be further amended from time to time, the "LOAN AGREEMENT")
pursuant to which, inter alia, Lender extended to Borrower certain credit
facilities.

         B. Borrower and Lender desire to further amend the Loan Agreement in
accordance with the terms and conditions set forth herein.

         C. Capitalized terms used herein and not otherwise defined shall have
the meanings given such terms in the Loan Agreement.

         NOW THEREFORE, the parties hereto, intending to be legally bound
hereby, agree as follows:

         1. ADJUSTED EXCESS AVAILABILITY; RESTRICTED CASH COLLATERAL.

                  (a) Subject to the provisions of SECTIONS 1(D) AND (E) below,
notwithstanding anything in the Loan Agreement or any of the other Financing
Agreements to the contrary, provided that the Deposit Balance (as defined below)
is at all times equal to or greater than Twenty-Five Million Dollars
($25,000,000.00), Borrower shall not be required to (i) comply with the Adjusted
Excess Availability covenant set forth in SECTION 9.17 of the Loan Agreement or
(ii) maintain Ten Million Dollars ($10,000,000.00) or any other balance in the
Restricted Cash Collateral Account.

                  (b) Subject to the provisions of SECTIONS 1(D) AND (E) below,
in the event that the Deposit Balance shall at any time be less than Twenty-Five
Million ($25,000,000.00), (i) Borrower shall immediately deposit cash in an
amount equal to Ten Million Dollars ($10,000,000.00) into an account maintained
with Lender, with respect to which account Lender shall have a first priority
perfected security interest and over which Lender shall have sole dominion and
control (with Borrower having no right of access thereto or withdrawal
therefrom), (ii) the Adjusted Excess Availability covenant set forth in SECTION
9.17 of the Loan Agreement shall become effective immediately, (iii) Borrower
shall immediately deliver to Lender an officer's compliance certificate in the
form required pursuant to SECTION 9.6 of the Loan Agreement showing Borrower's
calculation of its Adjusted Excess Availability and (iv) if necessary to comply
with the Adjusted Excess Availability covenant, Borrower shall be required to
immediately reduce the outstanding balance of the Revolving Loans by an amount
sufficient to be in compliance with such covenant.

                  (c) Borrower shall provide Lender with written notice
immediately upon Borrower becoming aware that the Deposit Balance is less than
Twenty-Five Million Dollars ($25,000,000.00), which notice shall include a
statement as to the actual Deposit Balance.

<PAGE>

                  (d) In the event the Deposit Balance shall at any time or from
time to time be less than Twenty-Five Million Dollars ($25,000,000.00), Borrower
shall not be required to comply with the requirements of SECTION 1(B)(I)-(IV)
above; provided, that (i) within the applicable Grace Period, the Deposit
Balance is restored to at least Twenty-Five Million Dollars ($25,000,000.00) and
(ii) if the Deposit Balance is less than Fifteen Million Dollars
($15,000,000.00) at any time (including, without limitation, during any Grace
Period), the Borrower shall have provided written evidence satisfactory to
Lender (A) on the Business Day the Deposit Balance falls below Fifteen Million
Dollars ($15,000,000.00) that Borrower has funds maintained with another
institution(s) in amounts sufficient to restore the Deposit Balance to at least
Twenty-Five Million Dollars ($25,000,000.00) within the applicable Grace Period
and (B) within one (1) Business Day after the Deposit Balance falls below
Fifteen Million Dollars ($15,000,000.00) that Borrower has given all necessary
instructions to the holder(s) of such funds to cause the amount necessary to
restore the Deposit Balance to Twenty-Five Million Dollars ($25,000,000.00) to
be wire transferred to Lender within the applicable Grace Period.

                  (e) In the event the Deposit Balance is less than Twenty-Five
Million Dollars ($25,000,000.00) and is not restored within the applicable Grace
Period, Borrower shall have the right after the expiration of the applicable
Grace Period, but not more than one (1) time during any Six Month Period, to
restore the Deposit Balance to at least Twenty-Five Million Dollars
($25,000,000.00) and, after such restoration, Borrower shall not be required to
comply with the covenants described in SECTION 1(A)(I) AND (II) above.

                  (f) As used herein, the following terms shall have the
following meanings:

                           (i) "DEPOSIT BALANCE" shall mean, from time to time,
the value of cash and investments in one or more deposit and/or securities
accounts maintained by Borrower with Lender or an affiliate of Lender, with
respect to which, in any case, Lender has a first priority perfected security
interest (and, if such account is maintained with an affiliate of Lender,
Borrower shall have entered into a control agreement with Lender and such
affiliate of Lender, which control agreement shall be in form and content
satisfactory to Lender).

                           (ii) "GRACE PERIOD" shall mean any period commencing
on the date that the Deposit Balance falls below Twenty-Five Million Dollars
($25,000,000.00) and ending on the date which is the third (3rd) Business Day
thereafter.

                           (iii) "SIX MONTH PERIOD" shall mean any period
commencing on the date on which the Deposit Balance falls below Twenty-Five
Million Dollars ($25,000,000.00) and ending on the date which is the one hundred
eightieth (180th) day thereafter.

         2. CAPITAL EXPENDITURES. SECTION 9.19 of the Loan Agreement is hereby
deleted in its entirety and replaced with the following:

            "9.19 CAPITAL EXPENDITURES. Borrower shall not, directly or
            indirectly, make total Capital Expenditures in excess of Forty-Five
            Million Dollars ($45,000,000.00) in the aggregate during the period
            from January 1, 2004 through December 31, 2005."

         3. Free Cash Flow




                                       -2-
<PAGE>

                  (a) In the event Borrower's Free Cash Flow for any fiscal
quarter ending after the date hereof shall be less than zero, in addition to all
other Reserves then in effect, a Reserve (a "FREE CASH FLOW RESERVE") shall be
established immediately in an amount equal to Borrower's negative Free Cash Flow
for such fiscal quarter.

                  (b) Once established, a Free Cash Flow Reserve shall remain in
effect (subject to increase or decrease as described in SECTION 3(C) below)
until Borrower shall have achieved, on a cumulative basis for the period from
the beginning of the fiscal quarter in respect of which the Free Cash Flow
Reserve was implemented through the end of any subsequent fiscal quarter, Free
Cash Flow of at least zero.

                  (c) As of the end of each fiscal quarter of Borrower after a
Free Cash Flow Reserve shall have been established (and not yet eliminated
pursuant to SECTION 3(B) above), the Free Cash Flow Reserve shall be increased
or decreased, if necessary, to an amount equal to the cumulative negative Free
Cash Flow of Borrower for the period from the beginning of the fiscal quarter in
respect of which the Free Cash Flow Reserve was implemented through the end of
such subsequent fiscal quarter of Borrower.

                  (d) In the event that any Free Cash Flow Reserve (or any
increases thereto) causes the amount of Revolving Loans and Letter of Credit
Accommodations to exceed the Borrowing Base, Borrower shall immediately pay to
Lender the amount of any such excess.

                  (e) Solely for the purposes of determining whether a Free Cash
Flow Reserve shall be established, increased or decreased, Borrower's Capital
Expenditures for the period from January 1, 2004 through and including December
31, 2005 shall not be deemed Unfunded Capital Expenditures in the calculation of
Free Cash Flow.

                  (f) If a Free Cash Flow Reserve has been established and then
eliminated, subsequent Free Cash Flow Reserve(s) may be established from time to
time if Borrower shall again have a Free Cash Flow for any fiscal quarter of
less than zero. Any such subsequent Free Cash Flow Reserve may be increased,
decreased and/or eliminated in accordance with the terms and conditions of this
Amendment.

         4. ADDITIONAL DOCUMENTS; FURTHER ASSURANCES. Borrower shall execute and
deliver to Lender, or cause to be executed and delivered to Lender, at the sole
cost and expense of Borrower, from time to time, any and all other documents,
agreements, statements, certificates and information as Lender shall reasonably
request to evidence or effect the terms of the Loan Agreement, as amended, or
any of the other Financing Agreements, as amended, or to enforce or protect
Lender's interest in all Collateral. All such documents, agreements, statements
certificates and information shall be in form and content acceptable to Lender.

         5. FURTHER AGREEMENTS AND REPRESENTATIONS. Borrower does hereby:

                  (a) ratify, confirm and acknowledge that the Loan Agreement
and all other Financing Agreements are valid, binding and in full force and
effect;

                  (b) covenant and agree to perform all obligations of Borrower
contained herein, in the Loan Agreement and in each of the other Financing
Agreements;

                                      -3-
<PAGE>

                  (c) acknowledge and agree that as of the date hereof, Borrower
has no defense, set-off, counterclaim or challenge against the payment of any
sums owing under the Loan Agreement or any of the other Financing Agreements or
the enforcement of any of the terms or conditions thereof;

                  (d) acknowledge and agree that, except as heretofore disclosed
to Lender by Borrower in writing, all representations and warranties of Borrower
contained in the Loan Agreement and each of the other Financing Agreements are
true, accurate and correct on and as of the date hereof as if made on and as of
the date hereof;

                  (e) represent and warrant that no Default or Event of Default
exists under the Loan Agreement or any of the other Financing Agreements;

                  (f) acknowledge and agree that nothing contained herein and no
actions taken pursuant to the terms hereof is intended to constitute a novation
of the Loan Agreement or any of the other Financing Agreements, and does not
constitute a release, termination or waiver of any of the liens, security
interests, rights or remedies granted to Lender therein, which liens, security
interests, rights and remedies are hereby ratified, confirmed, extended and
continued as security for the Obligations; and

                  (g) acknowledge and agree that Borrower's failure to comply
with or perform any of its covenants, agreements or obligations contained in
this Agreement shall constitute an Event of Default under the Loan Agreement and
each of the other Financing Agreements.

         6. FEES, COSTS, EXPENSES AND EXPENDITURES. Borrower agrees to pay all
of Lender's expenses in connection with the review, preparation, negotiation,
documentation and closing of this Amendment and the consummation of the
transactions contemplated hereunder, including, without limitation, fees,
disbursements, expenses and disbursements of counsel retained by Lender and all
fees related to filings, recording of documents and searches, whether or not the
transactions contemplated hereunder are consummated.

         7. RELEASE AND INDEMNIFICATION. In order to induce Lender to enter into
this Amendment, Borrower does hereby acknowledge and agree that it has no
claims, suits or causes of action against Lender and hereby remises, releases
and forever discharges each of Lender, and Lender's respective officers,
directors, shareholders, employees, agents, successors and assigns, and any of
them, from any claims, suits or causes of action whatsoever, in law or at
equity, which Borrower has or may have arising from any act, omission or
otherwise, at any time up to and including the date of this Agreement.

         8. INCONSISTENCIES. To the extent of any inconsistency between the
terms and conditions of this Agreement and the terms and conditions of the Loan
Agreement or the other Financing Agreements, the terms and conditions of this
Amendment shall prevail. All terms and conditions of the Loan Agreement and the
other Financing Agreements not inconsistent herewith shall remain in full force
and effect and are hereby ratified and confirmed by Borrower.

         9. BINDING EFFECT. This Amendment shall be binding upon and inure to
the benefit of the parties hereto and their successors and assigns.

                                      -4-

<PAGE>

         10. GOVERNING LAW. This Amendment shall be governed by and construed in
accordance with the laws of the Commonwealth of Pennsylvania.

         11. HEADINGS. The headings of the articles, sections, paragraphs and
clauses of this Amendment are inserted for convenience only and shall not be
deemed to constitute a part of this Amendment.

         IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be
executed effective as of the day and year first above written.


                         IMPAX LABORATORIES, INC.


                         By: /s/ Barry R. Edwards
                             --------------------------------------
                             Name/Title: Barry R. Edwards, CEO
                                         --------------------------

                         WACHOVIA BANK, NATIONAL
                         ASSOCIATION


                         By /s/ Margaret A. Byrne
                            ---------------------------------------
                            Name/Title: Margaret A. Byrne
                                        ---------------------------
                                        Vice President




                                      -5-