Lets go through a few things
- Clerics pray and prepare spells once per day, this determines all their spells for that day
- Clerics get additional spells to prepare depending on their wisdom bonus. These spells (as well as their base spell allowance) are alignment restricted:
Chaotic, Evil, Good, and Lawful Spells: A cleric can't cast spells of
an alignment opposed to her own or her deity's (if she has one).
Spells associated with particular alignments are indicated by the
chaotic, evil, good, and lawful descriptors in their spell
descriptions.
- Clerics get one domain spell for each spell level they can cast (1st, 2nd, 3rd etc). Clerics have two domains and this bonus spell must be one of the spells from their domains for that level.
- Orisons can be used as often as you want during that day
- Spells Level 1+ are "used up" when cast, the cleric can't use them again until they've prayed again the next day
- Clerics can also Spontaneously convert any of their spells (but not their bonus domain spell) into a cure or inflict spell of the same level.
So, the Level 1 Cleric with 1 bonus spell per day from wisdom.
Gets 3 Orisons - These can be cast as often as they like.
Gets 2 level 1 spells from any of the level 1 cleric spells. These can be spontaneously converted. Once cast, these are used up for the day.
Gets 1 level 1 spell from their domain spells. Once cast this is used up for the day.
Example:
Bob the Cleric of Chaos and Charm
Bob has prepared the following Spells:
0: Light, Mending, Bleed
1: Protection From Law (Bob is allowed either Charm Person or Protection from Law from his domains)
1: Bless
1: Doom
Bob can cast Light, Mending and Bleed as much as he wants.
Bob can cast Protection from Law, Bless and Doom once each per Day.
Bob could, if he wanted to, take 2 "Doom" spells as his non-domain spells instead, and as a result could cast Doom twice per day - what he chooses for his spells is entirely up to him.
Don't forget also the clerics highly useful channel energy ability!
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.
Best Answer
They can cast any spells on the appropriate spell list, they do not have a specific number of spells known.
Ranger
Druid
Where you probably read about gaining 2 spells known per level was probably in the description of the Wizard.