You can go several ways on this:<p><pre><code>  - work for hire (you sign over your rights)

  - give them a license, a head start and a discount (you have the rights)

  - make it a co-development and give them a stake in the
    future proceeds (you create some vehicle that holds the
    rights)
</code></pre>
The difference between those should be reflected in the price, and that's how you can control the situation to your advantage.<p>If I were in that boat I'd offer only two payment options, one that looks like they'll have to go and find a second mortgage on their building and another one that is very affordable indeed but gives you the right to sell the solution to others with the exception of their direct competitors in that locality, and only after some time has passed (say 3 months, 6 months or a year).<p>Having a minority partner in a project like that that has a different core business is a recipe for trouble.