<PAGE>

                                                                   EXHIBIT 10.5

                                   AGREEMENT

   THIS AGREEMENT ("this Agreement") made and entered into effective July 1,
1999, by and among DENNIS P. WILKINS, M. KENNY MUSCAT, AND JOHN MORRISSEY
(collectively, "Sellers" and individually, "Seller"), and DAVID A. DYE, M.
STEPHEN WALKER, JOHN BOYD DOUGLAS, JR., MELLISSA A. HAMMONS, PATRICK A. IMMEL,
THOMAS W. PETERSON, AND VICTOR S. SCHNEIDER (collectively, "Buyers" and
individually, "Buyer"), COMPUTER PROGRAMS AND SYSTEMS, INC., an Alabama
corporation (the "Corporation"), and AMSOUTH BANK (the "Lender").

                                  WITNESSETH:

   WHEREAS, each of the Sellers is selling certain Non-Voting Common Stock to
each of the Buyers in the proportions set forth on Exhibits "A", "B", and "C"
hereto;

   WHEREAS, the Sellers, the Buyers and the Corporation have requested that the
Lender finance the Buyers' acquisition of the above-described Non-Voting Common
Stock and the Lender has agreed to do so provided that, among other things, the
Corporation agrees to purchase the money loans made to the Buyers under the
circumstances set forth herein; and

   WHEREAS, the sale by Sellers to Buyers is of material benefit to the
Corporation in that it induces the Buyers to remain as employees of the
Corporation and become long-term employees of the Corporation; and

   NOW, THEREFORE, in consideration of the premises, and other good and
valuable consideration, the parties hereto do hereby agree as follows:

   1.  MATERIAL INDUCEMENT.  The Corporation, the Sellers, and the Buyers
acknowledge that their respective obligations under this Agreement are a
material inducement to the Bank to make the loans described herein.

   2.  EVIDENCE OF AND SECURITY FOR INDEBTEDNESS.  The loan to each of the
Buyers (each such loan as the same be renewed, extended, modified or
restructured is hereinafter sometimes referred to as "Loan") shall be evidenced
by a promissory note signed by such Buyer in favor of the Lender and secured by
a pledge of the Non-Voting Common Stock shares purchased by such Buyer
hereunder. Other than the foregoing pledge in favor of the Lender, for so long
as the purchase money lent by the Lender to such Buyer remains outstanding, no
Buyer shall transfer, sell, mortgage, place a security interest or lien upon,
or otherwise dispose of the shares purchased with funds lent to such Buyer by
Lender or resulting from recapitalizations or stock dividends that adjust the
outstanding shares of the Corporation's capital stock.

                                      1

<PAGE>

   3.  PURCHASE REQUIREMENT.  (a) In the event that (i) the employment of a
Buyer by the Corporation is terminated, at either the election of the
Corporation or such Buyer (a termination arising as a result of the Buyer's
death shall not be deemed a termination of employment for these purposes), or
(ii) the Lender declares a default by a Buyer under such Buyer's promissory
note (as the same may have been renewed, extended, modified or extended from
time to time) and/or pledge agreement to Lender, then the Corporation shall
purchase from the Lender, and the Lender shall sell to the Corporation, the
Loan made by the Lender to such Buyer whose employment was terminated or whose
promissory note and/or pledge agreement in favor of the Lender was declared to
be in default for cash within thirty (30) days after the termination of said
employment of such Buyer or the declaration of default of such Buyer's
promissory note and/or pledge agreement in favor of the Lender, as the case may
be.

   (b)  In addition, so long as any Loan remains unpaid, in the event that:

      (i)  as of any date, the total shareholders' equity (including capital
   stock, additional paid in capital and retained earnings after deducting
   treasury stock) which would appear on a balance sheet for the Corporation
   prepared as of such date in accordance with those generally accepted
   accounting principles and practices that are recognized by the American
   Institute of Public Accountants acting through its Accounting Principles
   Board or by the Financial Accounting Standards Board or through other
   appropriate boards or committees thereof and which are consistently applied
   for all periods after the date hereof as to properly affect the financial
   condition of the Corporation and the results of operations and changes in
   financial position of the Corporation with such changes in accounting
   principles and practices as are required by said Accounting Principles Board
   of Financial Accounting Standards Board (or other appropriate board or
   committee of said Boards) in order to continue as a generally accepted
   accounting principle or practice ("Generally Accepted Accounting Principles"
   or "GAAP") shall be less than $6,800,000.00;

      (ii)  the Corporation shall incur, create, contract, waive, assume, have
   outstanding, guarantee or otherwise be or become, directly or indirectly,
   liable with respect to any indebtedness, liability or obligation, whether
   contingent, liquidated or mature, to any person or entity other than Lender
   that would be reflected on the Corporations's balance sheet prepared in
   accordance with GAAP except for current liabilities for taxes and
   assessments incurred in the ordinary course of the Corporation's business,
   accounts payable or accrued that are incurred in the ordinary course of the
   Corporation's business and are promptly paid and discharged in accordance
   with customary trade terms, leases of personal property used in the business
   of the Corporation, and indebtedness reflected in the Corporation's latest
   financial statements provided to the Lender prior to the date of this
   Agreement;

      (iii)  the ratio of (1) the Corporation's income (or deficit) before
   provision for income taxes for any fiscal year of the Corporation, plus the
   Corporation's interest expenses for such period, plus the Corporation's
   non-cash expenses such as depreciation for such period, plus the expenses
   for rental of operational facilities for the Corporation for such period to
   (2) any dividends, including the value of any in kind dividends, paid or
   declared to the Corporation's shareholders during such period, plus the
   Corporation's interest expenses for such period, plus the amount of any
   principal reductions in the Corporation's indebtedness during said period,
   plus the expenses for rental of operational facilities for the Corporation
   for such period shall fail to be 1.1:1 or greater; or

      (iv)  the Corporation shall fail to comply with the requirements of
   Paragraph 3 or Paragraph 4 of this Agreement,

then the Corporation shall purchase from the Lender, and the Lender shall sell
to the Corporation, for cash within thirty (30) days for a demand by the
Lender, each Loan made by the Lender to any and all of the Buyers who have not
satisfied such indebtedness in full.

                                      2

<PAGE>

   (c)  In the event the Corporation is obligated in accordance with the terms
of this Agreement to purchase any Loan made to a Buyer, the purchase price
shall be an amount equal to the outstanding principal balance of such Loan plus
all accrued interest and other charges permitted under the loan documentation,
and the Lender shall assign such indebtedness, the evidence thereof, and the
security therefor, to the Corporation without warranty, representation or
recourse of any kind whatsoever other than as to the outstanding balance
thereof and that no encumbrances were created by the Lender.

   4.  FINANCIAL STATEMENTS AND CERTIFICATES.  Within ninety days of the end of
each of the Corporation's fiscal years while this Agreement remains in effect,
the Corporation shall provide to the Lender (a) financial statements as of the
end of such fiscal year, including without limitation a balance statement and
statements of income and expenses both for such fiscal year and comparative to
the prior fiscal year of the Corporation, and (b) a certificate of the chief
financial officer of the Corporation certifying that each of the Buyers who is
not deceased remains an employee of the Corporation and that no condition
exists that would require the Corporation to purchase the indebtedness of the
Buyers pursuant to paragraph 3(b) hereof. In addition, the Corporation shall
deliver to the Lender such additional financial information as the Lender might
reasonably request.

   5.  RELATIONSHIP OF PARTIES AND INDEMNITY.  The Corporation and the Buyers
acknowledge that the Lender is not a principal in the sale of the Non-Voting
Common Stock by the Sellers to the Buyers or the purchase of the same by the
Buyers and is not the agent of either the Corporation or of any of the Buyers
but, rather, is merely financing said purchase by the Buyers. Accordingly, the
Corporation, each of the Sellers, and each of the Buyers hereby agree to
indemnify and hold harmless the Lender from any and all claims, losses, and
liabilities, including without limitation any costs incurred in defending
against any such claims, losses, and liabilities or in collecting or attempting
to collect on its right to be indemnified hereunder, relating to the sale of
Non-Voting Common Stock by the Seller and the purchase of the same by the
Buyers or relating to the sale by the Lender to the Corporation of any Loan.

   6.  SUCCESSORS, HEIRS, EXECUTORS AND ADMINISTRATORS.  This Agreement shall
be binding upon the parties hereto and their respective successors, heirs,
executors, administrators, successors and assigns.

   7.  APPLICABLE LAW.  This Agreement has been executed in the State of
Alabama, and shall be governed by and construed in accordance with the laws
thereof.

                                      3

<PAGE>

   IN WITNESS WHEREOF, the said COMPUTER PROGRAMS AND SYSTEMS, INC. and AMSOUTH
BANK have each caused its respective name to be signed hereto by its duly
authorized officer and the Sellers and Buyers have hereunto set their
respective hands and seals, as of the month, day and year first hereinabove
written.


                                       CORPORATION:

                                       COMPUTER PROGRAMS AND SYSTEMS, INC.

                                       By:      /s/  David A. Dye
                                           -----------------------------------
                                       As its:         President

ATTEST:

By:      /s/   M.S. Walker
     ----------------------------
Its:       Secretary/Treasurer


                                       LENDER:

                                       AMSOUTH BANK

                                       By:         /s/  Claire G. Baker
                                           ------------------------------------
                                       As its:        Vice President


                                       SELLERS:

                                               /s/  Dennis P. Wilkins
                                       ----------------------------------------
                                       DENNIS P. WILKINS


                                                /s/  M. Kenny Muscat
                                       ----------------------------------------
                                       M. KENNY MUSCAT


                                                 /s/  John Morrissey
                                       ----------------------------------------
                                       JOHN MORRISSEY

                                      4

<PAGE>

                                                   BUYERS:


                                                   /s/  David A. Dye
                                                   -----------------------------
                                                   DAVID A. DYE


                                                   /s/  M. Stephen Walker
                                                   -----------------------------
                                                   M. STEPHEN WALKER


                                                   /s/  John Boyd Douglas, Jr.
                                                   -----------------------------
                                                   JOHN BOYD DOUGLAS, JR.


                                                   /s/  Mellissa A. Hammons
                                                   -----------------------------
                                                   MELLISSA A. HAMMONS


                                                   /s/  Patrick A. Immel
                                                   -----------------------------
                                                   PATRICK A. IMMEL


                                                   /s/  Thomas W. Peterson
                                                   -----------------------------
                                                   THOMAS W. PETERSON


                                                   /s/  Victor S. Schneider
                                                   -----------------------------
                                                   VICTOR S. SCHNEIDER

                                      5