Does imputation before split leak data from train to test dataset?

In this project, since we impute the missing values of the numeric columns with the mode of the column before we split the data, does this not leak data from train to the test dataset? Although it is only the mode that is being imputed so it shouldn’t be much of a leak, if it was the mean that we imputed it would be more of a data leak. From my looking into this, we should do the imputation after the train/test split and impute the mode/mean of the training set into the test set (not the mode/mean of the whole dataset).
The way I approached this project was to do the imputation after the split, because I created a new column ‘avg_sale_price_neighbourhood’ which has the average sale price of the neighbourhood that the hosue was sold in. This average price grouped by the neighbourhood was from the training set only and was also imputed into the test set. I was able to reduce the RMSE value by a significant amount by doing this.
Anyway, I’m hoping to get some feedback on my way of thinking and approaching this.
Cheers