This question is handled in the PHB.
If the skill is an exclusive skill, the max ranks is based on the total of all class levels which have access to that skill.
If the skill is a class skill for any of the classes, the max ranks is level +3.
If the skill is cross-class for all of your classes, the max ranks is (level+3)/2.
You always determine the number of skill points it costs to raise a skill based on what class you are advancing in.
Examples with Wiz4/ Rog 1:
Scry is an exclusive skill which Wizards can buy, max ranks = 7.
Decipher Script is an exclusive skill which Rogues can buy, max ranks = 4.
Disable Device is a class skill for rogues, max ranks = 8. Costs 2 skill points per rank if you are advancing as a wizard or 1 if advancing as a rogue.
Ride is a cross class skill for both Rogue and Wizard, max ranks = 4. Costs 2 skill points per rank for either Wizard or Rogue classes.
Hopefully this is clear.