Harmonic and melodic scales are artificial 'melodies', but many pieces do borrow these in a melody that comprises short scales. There is in fact really a small tendency for rising melodies to use raised 6th and 7th notes and for falling melodies to use the original unraised 6th and 7th. However, this is of course not a rule, nor is it theoretically the most euphonic. So it is no surprise at all to see the raised 6th and 7th in the falling scale in bar 2. In fact, a 7-6-5-1 melody is very common, just like a 5-6-7-1, and in the minor scale the 7th is almost always raised in such a melody. The 6th is usually raised as well, though if you do not it sounds fine too; it will sound different (strongly minor) but not unpleasant.
But there is a bigger misconception that I want to address. When a composer says that a piece is in A minor, it does not mean that the entire piece is in A minor, even in the composer's mind! And indeed it is not the case even in this short section that you have posted here. Change of key is also known as a modulation. Let us analyze this properly:
Bars 1 to 4 are indeed in A minor. Chords are I, V, I, V.
Bars 5 to 6 are in D minor. Chords are V, I. Note that the chord in bar 5 is A major as a chromatic change from A minor in bar 4. The B flat perfectly fits here as the 6th note in D minor. This is a very common modulation (to what is called the subdominant key).
Bars 7 to 8 are in C major! Chords are V, I. C major is the relative major for A minor, so it is a common target for modulation. How did the key get from D minor to C major? Well, one might argue that D minor is the pivot chord, being in the keys D minor and A minor and C major, so it facilitates the human mind from perceiving that the subdominant modulation was just a temporary one and that it is now jumping from the original key to the relative major.
Bars 9 to 12 are back in A minor, in my (subjective) opinion, and the chords are #VIIdim7, I, VIaug6, V, I. Here #VIIdim7 is a typical diminished 7th chord, and I feel that the melodic progression calls for the G# in the chord even though it is not in the melody, hence the "#VII" indicating the raised 7th from the minor scale. The (VIaug6, V) progression are in a single bar, as a quick move towards the final goal of I. Note that (VI, V, I) is a common progression, though here there is an additional note that fits into the melody because it is just a chromatic step away from and resolves to the next note E. Note that the general flavour will be unchanged if you omit the D#. (I have changed the chord identifications here based on Aaron's helpful feedback that my notation was not conventional.)
Bars 13 to 16 are again in A minor. Chords are uneventfully I, V, I, V.
After that, we have a repeat of the chord progressions, with bars 17 to 18 in D minor, bars 19 to 20 in C major, and bars 21 to 22 in A minor as we described above. And these bars also confirm the earlier analysis.
Finally bars 23 to 24 end the section in A minor, with chords II, V, I. This chord progression is also a common progression.
Most classical and romantic music are built around the chords I, V, IV, II, VI, III, in roughly that order of prominence, with the notes taken directly from the scale. (Note that some theorists use uppercase and lowercase to denote whether it is a major or minor chord, but I do not want to do that as I feel that the musical flavour arises from the scale and not just the chord itself. For instance, in the minor key what I write as chord II would be notated as ii(dim) in another convention, but the underlying flavour is still the same as the (II, V, I) in the major key, just that it sounds minor.)
As you can see above, we have indeed fully explained all the chords and accidentals used in this section of Paganini's piece; Not a single accidental was left unjustified!