I am trying to build a mock factory, like this:
public Mock<T> CreateMock<T>(SomeParams someParams) where T : IMyInterface
{
    Mock<T> result = new Mock<T>();
    ...
}

However, I am getting the compiler error CS0452: The type 'T' must be a reference type in order to use it as parameter 'T' in the generic type or method 'Mock'.
Yet, when I tried this, it worked just fine:
public Mock<IMyInterface> CreateMock(SomeParams someParams)
{
    Mock<IMyInterface> result = new Mock<IMyInterface>();
    ...
}

I don't understand, why I am getting the compiler error, when the code is functionally the same? Is there any simple way to workaround this? I would like to avoid the second approach, as it would require considerable changes in our testing infrastructure.

Cannot Mock but can Mock?

I don't understand, why I am getting the compiler error, when the code is functionally the same?

Consider this case:
public struct Awkward : IMyInterface
{
}
...
Mock<Awkward> mock = MockFactory.CreateMock<Awkward>();

That satisfies the constraint you've put on CreateMock - but Awkward is a value type. Mock<T> requires T to be a reference type.
You need to constrain the T type parameter in your method to be a reference type that implements the interface:
public Mock<T> CreateMock<T>(SomeParams someParams) where T : class, IMyInterface

