Echoing previous responses, unless otherwise specified, work like this (where a client pays a contractor for work) is considered work made for hire under the US Copyright Act. In accordance with this, all intellectual property (such as source code) would transfer to the client.
A solid FAQ on copyright and works made for hire is at: http://copyright.gov/circs/circ09.pdf.
That said, you could craft the agreement where the client licenses code from you for either a one-time flat fee or ongoing subscription-based payments (which you would position as support and access to upgrades). If the client is deploying the application within their own infrastructure, include language in the agreement to protect against unauthorized dissemination of the code to unauthorized third-parties.
The client will also (likely) request a clause that states they assume ownership of the code in the event you go out of business or communicate that you are no longer committed to product upkeep. Do a few searches for "source-code escrow" for some ideas.