I've been in this situation twice so far in just the last few years, and having to turn someone down who gave you an offer seems...well, downright unpleasant and awkward, doesn't it? I think this is because most of us do not like to receive rejection, and so we feel that saying no is itself unpleasant, and thus we can make the quick assumption that surely the person we said no to will dislike us or bear us ill-will, right?
Here's the funny thing: human behavior almost never actually works this way! It has taken me a long time for me to personally accept that people don't think the way I imagined they did, so I assure you this unpleasantness is completely natural - and something you'll need to get past right away, or it is going to hold you back.
It turns out that most decent people, when offering a job/position/opportunity, genuinely want you to take the best offer, even if they might be a bit disappointed that they couldn't offer you the most compelling option. Most people in positions to offer other people such opportunities have had to tell other people no themselves, and in fact regularly tell people no all the time now. They don't bear anyone ill will for this, and they themselves remember having multiple offers and having to take the subjectively best option at the time.
As a personal anecdote, the first time I recall experiencing this was for a summer internship at a company. I'd received a much higher offer to work somewhere else (nearly double), and I called the first company back and explained that I was very interested in their company, but received a very compelling offer and wondered if they had room to negotiate a bit. They checked, explained they could not for interns, but welcomed me to reapply once I graduate and they promised they'd be able to make a much more compelling offer. I thought they were being polite and would never seriously consider me again, but their corporate recruiter contacted me multiple times over the next few years to see if I might be interested in working with them. I had it happen again in a research position, where again the people I turned down seemed keen on trying to recruit me again!
It turns out that not only do reasonably people understand if you take a more compelling offer (especially if they consider the other offer impressive!), but the fact that you had the other offer - and how politely and sincerely you handled turning them down last time - reflects very well on you, and sometimes you'll find they end up liking you and wanting to recruit you even more! Not all the time, surely - but I've had it happen more times than I had the reverse occur. People who have a lot of options are desirable for lots of reasons, and the funny thing about being desirable is that a genuine expression of interest from you in them and their program is a far more valuable compliment than from someone who is deemed "less in-demand". They know you can afford to be picky, and that's often a desirable trait in any recruiting effort.
So by all means, it is absolutely appropriate to reapply - go for it! Be sincere, and if you feel like it you can even express how you hated to be unable to accept their offer last time, and would very much like to work with them. One caveat, though - this will only work so many times. If you decline them again and again, that's going to get old for just about anyone, so I'd suggest you be reasonably sure you actually want to work for them, or otherwise you're just stringing them along.