In many contexts they're interchangeable. I sometimes feel there's a sense that allegiance is something you owe (almost as a duty) and loyalty is something you feel.
'Zidane's allegiance was to France, but fellow Algerians in the district of Marseille where he grew up now feel a stronger loyalty for Algeria.'
But this is a very fine - and easily refuted
- distinction. Zidane was a loyal Frenchman!