This is a very simple instance of the use of parallel modes; in this case parallel major and minor. Parallel use of and ambiguity between major and minor is very common in the Blues and Jazz, pervading popular musical practice related to these. It is found in classical music. For instance in J. S. Bach's Em Suite for Lute (BWV 996) the Allemande and Courante movements end on a E major harmony in contrast to the other movements which more conventionally return to E minor. Bach executes the shift very smoothly, concealing it in flawless counterpoint. The listener is not "hit in the face", so to speak, with an abrupt shift to a parallel mode, but feels the mood change nevertheless. In later periods, more abrupt uses of parallel modes became more common and of course we are used to that today.
It seems worth mentioning that the use of natural minor and melodic or harmonic minor is also a use of parallel modes. The top tetrachord of the melodic minor is identical to the major! That is to say, the only difference between major and melodic minor is one note: the third. This is why Baroque music is able to execute the shift to a major harmony ending. If the tune already uses melodic minor, it just has to tweak one note by a half step to shift to major. In the context of Western historic practice, the melodic minor seems to have provided the pathway to the parallel major.
The D E ending could occur in music that is mostly in the key of E major, not only as an unexpected shift out of E minor. For instance, play E A B ... Am D E. The first chords squarely anchor us in E major. Then there is a surprising mood change with the Am D shift into the parallel minor, with a shift back to a major ending. The E B A ... Am D E rearrangement is also interesting due to how the A becomes a pivot for the mode shift, perpetrating it with a single note change in contrast to unchanging notes.
We have to remember that "major" and "minor" are just theoretical constructions. There is a fundamental note, and in relation to it there are various other notes of a scale. If we have music organized around the C note, there is on inherent reason why we shouldn't use the E# note if we are also using E, or vice versa. Rules like that are a matter of taste and are the determinants of a genre or period-specific musical practice.
The use of parallel modes gives rise to creative harmonic devices, because fragments of a device in one key can be combined with fragments in another key. In Jazz for instance, some of the alterations of the dominant harmony can be understood as borrowing from a parallel mode. If we look at a minor key, the +5 note of the dominant V7+5 is in the scale! If we bring that into a major context, it creates a funny mood. The V7#9 chord's #9 is also in the minor scale rooted at I. Both these devices can be understood as manifestations of parallel major/minor.
[New edit]
I neglected something important. Use of parallel modes is not restricted to just minor and major, of course. That per se is clear, but there is a special case that is relevant here: parellel Mixolydian and (natural) minor. This is a device commonly seen in pop music, rock, Jazz and Blues. A tune that is in Em but contains D E transitions may be shifting to E Mixolydian. If there is instrumental or vocal improvisation happening over a C D E ending, it can switch to E Mixolydian.
The parallel Mixolydian and natural minor is interesting, because the parallel Mixolydian has the same key signature as another minor key that is a whole step up. For instance, E minor has the G major key signature, that being its relative major. E Mixolydian has the A major key signature: a whole tone up.
Music that shifts between parallel minor and Mixolydian allows the musical composition or improvisation to simply shift keys by a tone up and down. Stated differently, we can move the key by a tone this way and that way (between G and A), while maintaining the same tonal centre (the root E note, giving E minor or E mixolydian).
And then, E minor is the same as D Mixolydian. So in a pop or rock tune, if we play some D-Mixolydian-based figure over the D chord, and then E mixolydian over the E, then what is happening key-signature-wise is the same as the change from E minor to E Mixolydian. Thus, a full step change is tying in in with parallel mode use, which can be exploited.