Yes, KDE is free software according to the GNU General Public License. All KDE libraries are available under the LGPL making commercial software development for the KDE desktop possible, all KDE applications are licensed under the GPL.
KDE uses the Qt C++ crossplatform toolkit, which comes with its own license.
In short, Qt's license allows you to use Qt free of charge for development of X Windows software as long as you make the source code of your applications freely available. If you do not wish to make the source code of your applications written using Qt available for free, you must obtain a commercial license for Qt. You can find more information about the Qt and its license on Troll Tech web site.
If you are in doubt about which license is appropriate for you, please contact Troll Tech directly.
It is absolutely legal to make KDE and Qt available on CD free of charge. No runtime fees of any kind are incurred.