I used to have the same issue.
Whenever I make cupcakes, I always leave them to cool in their cases in the cupcake tray. I found that taking the cakes out of the tray before they had almost cooled caused the cases to peel away. But, elli is right, sometimes the recipe can cause this problem.
Hope this helps Xx
Laura Loukaides - Instagram.com/LauraLoukaides