If the amount of matter is the same, by definition, the mass is the same. Mass is the measurement of the amount of matter in a object/space.
I hate linking Wiki but this page sums up quite well that mass is not something that changes within a confined object without creation or removal of matter.
http://en.wikipedia.org/wiki/Mass
I think perhaps you're thinking of weight.
And yes, the density of an object changes readily when the volume of an object changes but the mass remains the same. If you take a cylinder of aluminum that has a given mass, and change the temperature, even by minute amounts, the density will change, because the volume of that cylinder will expand, however minutely.