Yes, they stack like the rule you cite says, if the specific class says they do. This is an example of exception-based design - the general rule is "only the one class counts" but then the specific rules in the other classes can say "but I do."
Not all prestige classes are alike so you should carefully read their Spellcasting benefit. In this case, Arcane Trickster says "I stack."
But classes that do not say that phrase, like Wizard and Sorcerer, do not stack. In your second example, Loremaster's spellcasting is worded like Arcane Trickster (as if she had gained a level in a spellcasting class she belonged to...), and you would need to decide whether you want it to stack onto your 5th level wizard spellcasting or your completely separate 3rd level sorcerer spellcasting. Assuming the former, you'd cast your spells from wizard slots at level 8 and your ones from your sorcerer slots at level 3.
It's kinda obvious why this is, the core idea behind prestige class design is "continue what you were doing, down a slightly weirder path" and therefore completely penalizing a spellcaster by e.g. halving their spellcaster abilities would be undesirable (even at that, many don't add a spellcasting level at every level and have one or two "penalty" levels.
Each time you gain an indicated level of Arcane Archer, choose a class which grants arcane spellcasting and in which you already have at least one level. When looking at the "spells per day" and "spells known" tables, start with the number of actual levels you have in that class, and add the number of times you've chosen that class in step one. Similarly, when determining ranges, durations, and other level-dependent effects, use that higher caster level.
So, your Sorc 3/Ranger 5 wants to start taking Arcane Archer levels. She gains enough XP to attain level 8, and takes her first AA level. The AA "Spells Per Day" column has a dash, so spell casting is unaffected. She does gain Enhance Arrows, of course.
A while later, she gains 9th level and takes her second AA level. AA's "Spells Per Day" column has "+1 level of existing class", so she has to choose an arcane spell-casting class in which she has levels; her only choice is Sorcerer, so she chooses Sorc. AA gives her Imbue Arrow, and she treats her Sorc level as 4 to determine spells per day (ie., she gains 2nd level Sorc spells (plus whatever she gets from her CHA)), spells known (ie., she learns one cantrip and one 2nd level spell), caster level-dependent effects (eg., range, duration, number of magic missiles, concentration check modifiers, etc.). She does not, however, increase the power of any Bloodline Powers she may have. Were she to have Wizard levels, she could choose to increase her Wizard caster level in the same way, but she would not get the two spells per level for free (ie., she'd have to add spells to her spellbook by transcribing them from a scroll or another spellbook), nor would her familiar or bonded item gain in power.
If a wholly different character were going into Arcane Archer with two classes which offered arcane spellcasting, they could choose which class to advance at each AA level. There are 7 levels at which he could increase an arcane caster level, so he could add 7 to one class and 0 to another, or 6 and 1, 5 and 2, or 4 and 3; similarly, he could choose to do so in any order he wished: 3 of one class, one of the other, then 3 of the first again, for example.
Best Answer
A prestige class that advances spellcasting usually does not also add spells to a class's spellbook
The FAQ says
An eldritch knight who enters that prestige class as a wizard, for example, receives no additional spells in his spellbook for advancing as an eldritch knight.