Inconsistency in shapes of `coef_` attributes between `LinearRegression` and `Ridge` when parameter `y` is 2D with `n_targets = 1`

### Describe the bug

This issue comes from my (possibly incorrect) understanding that `LinearRegression` and `Ridge` classes should handle the dimensions of the `X` and `y` parameters to the `fit` method in the same way in a sense that the *same* pair of `(X, y)` parameter values provided to *both* `LinearRegression.fit()` and `Ridge.fit()` methods should produce the `coef_` attribute values of the *same shape* in both classes.

But it appears that in case of a 2D shaped parameter `y` of the form `(n_samples, n_targets)` with `n_targets = 1` passed into the `fit` method, the resulting shapes of `coef_` attribute differ between `LinearRegression` and `Ridge` classes.

### Steps/Code to Reproduce

```python
import numpy as np
import sklearn

X = np.array([10, 15, 21]).reshape(-1, 1)
y = np.array([50, 70, 63]).reshape(-1, 1)

assert X.shape == (3, 1), f"Shape of X must be (n_samples = 3, n_features = 1)"
assert y.shape == (3, 1), f"Shape of y must be (n_samples = 3, n_targets = 1)"

linX = sklearn.linear_model.LinearRegression()
linX.fit(X, y)

ridgeX = sklearn.linear_model.Ridge(alpha=10**9.5)
ridgeX.fit(X, y)

assert linX.coef_.shape == ridgeX.coef_.shape, f"Shapes of coef_ attributes do not agree. LinearRegression has {linX.coef_.shape}. Ridge has {ridgeX.coef_.shape}"
```

### Expected Results

The example code should produce no output and throw no error.

According to the [`LinearRegression` docs](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#), the resulting value of the `coef_` attribute should be 2D shaped as `(n_targets = 1, n_features = 1)`. This is what happens in my minimal code example, indeed.

The [docs for the `Ridge` class](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html) are less detailed but the parameter and attribute names, types, and shapes are the same for `X`, `y`, and `coef_`. I can't think of a reason why the logic of how the shapes of `X` and `y` parameters translate into the shape of the `coef_` attribute should be any different from the `LinearRegression` class.

Since the *same* input pair `(X, y)` was given to both `LinearRegression` and `Ridge` instances, I expect the shape of the `coef_` attribute of the `Ridge` instance to be 2D as well. The shape should be exactly as per [`Ridge` docs](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html) state. In my case the shape would be `(n_targets = 1, n_features = 1)`, just as with the `LinearRegression` instance.

### Actual Results

An assertion error is produced by the sample code because the shapes of the `coef_` attribute are different between the `LinearRegression` and `Ridge` instances:

```pytb
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
[<ipython-input-5-de4d6a04a66d>](https://localhost:8080/#) in <cell line: 16>()
     14 ridgeX.fit(X, y)
     15 
---> 16 assert linX.coef_.shape == ridgeX.coef_.shape, f"Shapes of coef_ attributes do not agree. LinearRegression has {linX.coef_.shape}. Ridge has {ridgeX.coef_.shape}"

AssertionError: Shapes of coef_ attributes do not agree. LinearRegression has (1, 1). Ridge has (1,)
```

Thus, 

* `LinearRegression.coef_` is of the shape `(n_targets, n_features)`
* `Ridge.coef_` is of the shape `(n_features,)`

I don't think this is right?

### Versions

```shell
System:
    python: 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
executable: /usr/bin/python3
   machine: Linux-6.1.85+-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.6.0
          pip: 24.1.2
   setuptools: 75.1.0
        numpy: 1.26.4
        scipy: 1.13.1
       Cython: 3.0.11
       pandas: 2.2.2
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 2
         prefix: libopenblas
       filepath: /usr/local/lib/python3.10/dist-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Haswell

       user_api: blas
   internal_api: openblas
    num_threads: 2
         prefix: libopenblas
       filepath: /usr/local/lib/python3.10/dist-packages/scipy.libs/libopenblasp-r0-01191904.3.27.so
        version: 0.3.27
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 2
         prefix: libgomp
       filepath: /usr/local/lib/python3.10/dist-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
```

COMMENT:
Hi @olliefr, this is a known issue that hasn't been settled yet. I'm closing this one as duplicate of https://github.com/scikit-learn/scikit-learn/issues/20634.

Labels: Bug, Needs Triage