OK, let me take a stab at what I 'think' you're talking about. Let's assume that you have a hollow rectangular cylinder with inner side lengths a, b; and height h. You also have a solid rectangular cylinder of lengths a, b, the height being irrelevant, and the weight, w. You want to know that given a "perfect" fit, how far down will the weight fall before it comes to rest given the pressure force it has generated.
If this is the case, then we can do it, but we must make some assumptions. Firstly, the gas compression is isentropic; that is, no heat is generated and the process is reversible with no loss in energy. Secondly, the fit is perfect and frictionless; that is, no heat is generated and all of the volume of gas below the mass stays below.
We define the distance the weight has fallen measured from the bottom (just slightly easier, you'll see) as x, and the pressures above and below as [tex]p_1[/tex] and [tex]p_2[/tex] respectively.
The weight will come to equilibrium when the force on the top equals the force on the bottom. There are three forces, two pressure forces and weight. Our free-body gives us:
[tex]
(p_2 - p_1)a b = w[/tex]
The isentropic compression of a gas is given by
[tex]
\frac{p_2}{p_1} = \left(\frac{V_1}{V_2}\right)^\gamma[/tex]
Where the V are before and after volumes. We solve for the pressure below the piston:
[tex]
p_2 = p_1\left(\frac{V_1}{V_2}\right)^\gamma[/tex]
Since we don't care about a volume fraction, rather we'd know the height, we substitute in before and after volumes.
[tex]
p_2 = p_1\left(\frac{hab}{xab}\right)^\gamma[/tex]
the width and height cancel giving is a simple ratio of heights:
[tex]
p_2 = p_1\left(\frac{h}{x}\right)^\gamma[/tex]
We then plug this value for the pressure below the "piston" back into the force equilibrium equation:
[tex]
\left[ p_1\left(\frac{h}{x}\right)^\gamma - p_1\right] a b = w[/tex]
Now, if I did my algebra correctly, the solution for x would be:
[tex]
x = \frac{h}{ \left[\frac{w}{p_1 a b} + 1\right]^{\frac{1}{\gamma}} }[/tex]
The distance from the top y, could then be simply given by h-x. Also realizing that [tex]p_1[/tex] should just be ambient pressure. oops, almost forgot, [tex]\gamma[/tex] is the ratio of specific heats, defined as [tex]c_p / c_v[/tex]
Of course...there could be typos everywhere, but I think the process should be OK.