Zero-frequency response of an IIR transfer function
Because of the pole near the unit circle the impulse response doesn't really settle until after tens of thousands of samples. In comparison, your input of 15 samples is very short. Try making it longer:

x = rand(15E6,1);
y = filter(b,a,x);
mean(y)/mean(x)

&gt;&gt; 0.34252


Also, the filter starts in a state that corresponds to an all-zeros input history. If you precondition it with a run of the actual input, the result will converge faster:

x = rand(15E6,1);
y = filter(b,a,x);
mean(y(5E6:length(y)))/mean(x(5E6:length(x)))

&gt;&gt; 0.34483