I am wondering what is the difference between a CMS and a Framework?

From my understanding, a CMS is a pre-built system that allows you to quickly add/modify content. It gives the average user enough flexibility to change what your site does by installing modules and themes.

A framework is a system, sort of like a CMS, but grants you even more flexibility with your site as you are to write all of the code yourself.

I am wondering if my understanding of a CMS and Framework is accurate?

If so, I am wondering why is it so important to use a CMS or Framework to develop your websites? What are its benefits? I still don't quite understand that part.