I cashed my CD before it matured, and the bank charged me an early withdrawal penalty. Can it do this?
Yes. CD's are not liquid; when you buy one, you enter into a contract involving a fixed amount of money (principal) for a predetermined period of time (the term) and an agreed-upon interest rate and yield.
Banks are generally required by law to assess an early withdrawal penalty whenever funds from a CD are withdrawn prior to the date of maturity. This penalty should be explained in the Deposit Account Agreement you received when you opened the account.