From the Catholic perspective, freedom is not the ability to do whatever we want to do. It is the ability to live as we ought, according to God’s will. We tend to think that rules and requirements make us less free. In some cases, this is accurate. Unjust laws, or the unjust application of them, can and do limit freedom. However, when the laws are just and when they are applied properly and justly, the opposite of conventional wisdom is true, in that laws and rules actually serve to enhance freedom rather than limit it. God’s laws have the benefit of being perfect which means that the teachings of the Church rest on a solid foundation of revealed truth, provided they are interpreted and applied correctly. The laws that we make up? Not so much.
Here is an example: First, take a person who hears beautiful music in their head and sit them down behind a piano when they do not know how to play one. They are not free to express themselves on the piano because they have not mastered the necessary skills to do so. They have not sacrificed, studied, worked, etc, to achieve that level of skill and knowledge. Next, take a world class jazz pianist. He/she has studied and practiced for many years. She/he knows the rules of musical theory, proper technique, etc. Initially, these rules might have seemed constrictive and they might have felt that they were limiting their expression in improvisation, which is a huge part of jazz music. However, over time they come to see how this level of mastery of one’s self allows for expression on the piano with great freedom. Whatever they hear and desire to play, they can. Any piece of music they pick up and wish to play, they can. For the expert, the training, rules, and requirements necessary to become a virtuoso pianist have made them free in a way that the other person will never know.
In a similar way, when we do not master our own desires for sin, money, prestige, etc. we become slaves to that desire. This is the goal of the spiritual life. This is where God’s laws and the teachings of the Church come in. If we follow them, we are able to master our desires and we become free to be the person we were meant to be. We remain in the world, but we are not of the world. That, is true freedom.