Due to thekitchn website the difference between muffins and cupcakes is the following:
A muffin is something that's relatively healthy. It's not too sweet, perhaps made with whole wheat flour, and is more likely to be loaded with fruit than candy (ex: Blueberries). A muffin can also be savory instead of sweet. The texture is usually dryer and slightly denser than their cupcake cousins.
Cupcakes are, well, miniature cakes. They're sweet by definition, coming in flavors like vanilla, chocolate, and red velvet. A cupcake is tender and rich with eggs and butter. They're a dessert item, not an everyday breakfast food. And cupcakes always have frosting.
Another definition of muffins due to Diana’s Desserts is:
'A basic formula for muffins is 2 cups flour, 2-4 tablespoons sugar, 2½ teaspoons baking powder, ½ teaspoon salt, 1 egg, ¼ cup oil, shortening or butter and 1 cup milk. When the fat, sugar and egg ratio in a recipe reaches double or more than this, you have reached the cake level.'
Due to the preceding formulas, we can deduce that the muffin is lighter and healthier than a cupcake by having less fats (butter and milk), less eggs and sometimes whole wheat or oats instead of normal flour.