It is perfectly legal: the class is a service or thing of value, and there is no law requring employers to give services or things of value to their staff. The only thing you are entitled to is the pay and benefits you receive as compensation for working. Certainly, your employer could let you take these classes for free, but they are not required to do.