Michael is a great resource.
In the past, I used a proprietary PHP library for building websites. That library is licensed for use by those past clients only on their original domain names. It is encoded for security against hackers, for better performance, and to protect my rights as the developer of the code. It may not be examined or redistributed.
But now, I build most new websites using Drupal, which is "open source", which means that I don't own any of the code. It is licensed to be freely used by you. Third-party applications, such as shopping carts, are owned by their respective creators, and usually offer a license for use by anyone, without charge. The client owns the text, images, and other content that he created, including anything edited by me. Copyright and ownership of the complete website are transferred to the client only when full payment is received. I reserve the right to use a screenshot and description of the website in marketing materials, such as the portfolio section on my website. a Supreme Court ruling. The client holds a lifetime license to use the code only for the original website, and cannot redistribute it, nor resell it, except with the business. -->